0
當我爲了創建和發佈關係連接執行我的Java程序,我得到的錯誤:創建/發佈連接SDK:錯誤(SLS 16002)
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
:)