0

When I execute my Java program in order to create and publish relational connection, I get the error :

com.sap.sl.sdk.authoring.internal.AuthoringException: An error occurred while getting the list of connection drivers {0}. (SLS 16002)

my code as below :

 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();
    }

}

}

the line that get in error is :

RelationalConnection connection = connectionFactory.createRelationalConnection(connectionName, dbmsName, ntwkName);

Any help is appreciated.

Best Regard,

MJ

:)

1 Answers1

1

the error was related to 64Bit JVM, now using 32Bit JVM its works!

Thanks a lot,
MJ :)