当我执行我的Java程序以创建和发布关系连接时,我收到错误:
com.sap.sl.sdk.authoring.internal.AuthoringException:获取连接驱动程序列表{0}时发生错误。 (SLS 16002)
我的代码如下:
public class createnewuser {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String CMS = "WIN-SADERTL72LE:6400";
String userID = "administrator";
String password = "zxscdfv";
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.
SlContext context;
context = SlContext.create();
context.getService(CmsSessionService.class).setSession(enterpriseSession);
CmsResourceService service = context.getService(CmsResourceService.class);
String tempFolder = "c:\\Temp\\";
String user = "cms_boxi4"; // dbconnection.getParameter(DatabaseConnection.USER_NAME).getValue();
String pwd = "zxcdfgh" ;
String dbmsName = "MS SQL Server 2008" ; //dbconnection.getParameter(DatabaseConnection.DBMS).getValue();
String ntwkName = "OLE DB Providers" ; //dbconnection.getParameter(DatabaseConnection.NETWORK_LAYER).getValue();
String connName = "WIN-SADERTL72LE" ; //dbconnection.getParameter(DatabaseConnection.DATASOURCE).getValue();
String dbName = "cms_boxi4";
String connectionName = "SDKTestRelationalConn";
com.sap.sl.sdk.authoring.connection.ConnectionFactory connectionFactory;
connectionFactory = context.getService(com.sap.sl.sdk.authoring.connection.ConnectionFactory.class);
RelationalConnection connection = connectionFactory.createRelationalConnection(connectionName, dbmsName, ntwkName);
connection.getParameter("DATASOURCE").setValue(connName);
connection.getParameter("DATABASE").setValue(dbName);
connection.getParameter("USER_NAME").setValue(user);
connection.getParameter("PASSWORD").setValue(pwd);
System.out.println("Passo 4");
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);
}
enterpriseSession.logoff();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
出错的行是:
RelationalConnection connection = connectionFactory.createRelationalConnection(connectionName, dbmsName, ntwkName);
感谢任何帮助。
最好的问候,
MJ
:)
答案 0 :(得分:1)
错误与64Bit JVM有关,现在使用32Bit JVM工作!
非常感谢,
MJ
:)