Dear All,
when I execute my Java program in order to create and publish a BICS OLAP connection, I get the error :
com.sap.sl.sdk.authoring.internal.AuthoringException: The connection driver “SAPNETWEAVER7X/SAPBW_BICS” is unknown. (SLS 16000)
my code as below :
package CreatePublishConnOLAP;
import java.io.File;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.framework.ISessionMgr;
import com.sap.sl.sdk.framework.SlContext;
import com.sap.sl.sdk.framework.cms.CmsSessionService;
import com.sap.sl.sdk.authoring.cms.CmsResourceService;
import com.sap.sl.sdk.authoring.connection.OlapConnection;
import com.sap.sl.sdk.authoring.connection.RelationalConnection;
public class CreatePublishConnOLAP {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("java.vendor: " + System.getProperty("java.vendor"));
System.out.println("java.version: " + System.getProperty("java.version"));
System.out.println("java.vendor.url: " + System.getProperty("java.vendor.url"));
System.out.println(System.getProperty("sun.arch.data.model"));
System.out.println(System.getProperty("java.vm.name"));
String CMS = "WIN-SADERTL72LE:6400";
String userID = "administrator";
String password = "zxcvvdwqd";
String auth = "secEnterprise";
IEnterpriseSession enterpriseSession;
try
{
ISessionMgr mySessionMgr = CrystalEnterprise.getSessionMgr();
enterpriseSession = mySessionMgr.logon(userID, password, CMS,auth);
if (enterpriseSession != null)
{//Create and store useful objects for the session.
System.out.println();
System.out.println("enterpriseSession : " + enterpriseSession);
System.out.println();
SlContext context;
context = SlContext.create();
context.getService(CmsSessionService.class).setSession(enterpriseSession);
CmsResourceService service = context.getService(CmsResourceService.class);
String tempFolder = "c:\\Temp\\";
System.out.println("START Program ------");
System.out.println(" --> STEP.1 Defining Connection parameters");
String dbmsName = "SAPNETWEAVER7X"; //dbconnection.getParameter(DatabaseConnection.DBMS).getValue();
String ntwkName = "SAPBW_BICS";
String connectionName = "P0B_SDK";
String SAP_SERVER_TYPE = "Server";
String SAP_SYSTEM_ID = "P0B";
String SAP_APPLICATION_SERVER_NAME = "193.169.33.107";
//-- SAP_GROUP_NAME
//-- SAP_MESSAGE_SERVER_NAME
String SAP_SYSTEM_NUMBER = "12";
String SAP_CLIENT_NUMBER = "001";
String AUTHENTICATION_MODE = "SSO";
//String userOlap = "northwind";
//String pwdOlap = "Zavatta01";
com.sap.sl.sdk.authoring.connection.ConnectionFactory connectionFactory;
connectionFactory = context.getService(com.sap.sl.sdk.authoring.connection.ConnectionFactory.class);
System.out.println(" --> STEP.2 Creating Connection");
OlapConnection connection = connectionFactory.createOlapConnection(connectionName, dbmsName, ntwkName);
//RelationalConnection connection = connectionFactory.createRelationalConnection(connectionName, dbmsNameOlap, dbmsNameOlap);
connection.getParameter("SAP_SERVER_TYPE").setValue(SAP_SERVER_TYPE);
connection.getParameter("SAP_SYSTEM_ID").setValue(SAP_SYSTEM_ID);
connection.getParameter("SAP_APPLICATION_SERVER_NAME").setValue(SAP_APPLICATION_SERVER_NAME);
connection.getParameter("SAP_SYSTEM_NUMBER").setValue(SAP_SYSTEM_NUMBER);
connection.getParameter("SAP_CLIENT_NUMBER").setValue(SAP_CLIENT_NUMBER);
connection.getParameter("AUTHENTICATION_MODE").setValue(AUTHENTICATION_MODE);
//connection.getParameter("USER_NAME").setValue(userOlap);
//connection.getParameter("PASSWORD").setValue(pwdOlap);
System.out.println(" --> STEP.4 Publish Connection");
com.sap.sl.sdk.authoring.local.LocalResourceService localResourceService = context.getService(com.sap.sl.sdk.authoring.local.LocalResourceService.class);
localResourceService.save(connection, tempFolder + connectionName + ".cnx", true);
service.publish(tempFolder + connectionName + ".cnx", "/Connections" , true);
System.out.println(" --> STEP.5 Deleting Files on Temp folder");
File file = new File("C:\\Temp");
String[] myFiles;
if(file.isDirectory()){
myFiles = file.list();
for (int i=0; i<myFiles.length; i++) {
File myFile = new File(file, myFiles[i]);
myFile.delete();
}
}
System.out.println("End Program ------");
}
enterpriseSession.logoff();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void DeleteOneFile(String FileName)
{
try{
File file = new File(FileName);
if(file.delete()){
System.out.println(file.getName() + " is deleted!");
}else{
System.out.println("Delete operation is failed.");
}
}catch(Exception e){
e.printStackTrace();
}
}
}
Any help is appreciated.
Best Regard,
ZAV
zavatta_fighter (BOB member since 2005-05-10)