Decision Optimization

 View Only
  • 1.  CPLEX Optimization 20.1 - IBM ILOG Concert: No suitable driver found for jdbc:sqlserver

    Posted Thu May 13, 2021 04:33 PM
    Hello. 

    I am working with OPL 20.1 on a Windows 10 a 64 bits laptop. I am trying to connect a SQL Server 2014 database, using a JDBC driver (mssql-jdbc-9.2.1.jre8.jar). 

    I am reading the database into IBM ILOG CPLEX Optimization Studio using statements in a .dat file, the code is shown below: 

    JDBCConnection conn("jdbc:sqlserver://ServerName:Port;databaseName=DatabaseName;integratedSecurity=true;trustedconnectio=true","");

    I download the JDBC driver and I set it as an environment user variable CLASSPATH to make it available to the JVM used by OPL. 

    The problem is that when trying to execute the previously shown code, I get the following error: 

    Excepción de IBM ILOG Concert: No suitable driver found for jdbc:sqlserver://ServerName:Port;databaseName=DatabaseName;integratedSecurity=true;trustedconnectio=true. Prueba201.dat /Prueba201 12:125-126 D:\ILOG\OPL\Prueba201\Prueba201\Prueba201.dat Marcador de problema de OPL

    What could I be doing wrong? How do I set the driver to use?

    Thank you.

    Best regard.



    ------------------------------
    Alexander Diaz
    ------------------------------

    #DecisionOptimization


  • 2.  RE: CPLEX Optimization 20.1 - IBM ILOG Concert: No suitable driver found for jdbc:sqlserver

    Posted Mon May 17, 2021 03:06 AM
    Dear Alexander,

    Instead of setting CLASSPATH variable, please try in a terminal window:

    c:\> set ODMS_JAVA_ARGS=-classpath /path/to/your/driver.jar
    c:\> oplrun yourmodel.mod yourmodel.dat

    (using oplrun on the terminal can display more useful error messages if needed)

    Best regards,

    ------------------------------
    Viu Long Kong
    ------------------------------



  • 3.  RE: CPLEX Optimization 20.1 - IBM ILOG Concert: No suitable driver found for jdbc:sqlserver

    Posted Tue May 18, 2021 08:07 AM
    Dear Viu Long Kong.

    Thanks for the reply. I tested and loaded the driver, thanks for your help.

    Best regards.

    ------------------------------
    Alexander Diaz
    ------------------------------



  • 4.  RE: CPLEX Optimization 20.1 - IBM ILOG Concert: No suitable driver found for jdbc:sqlserver

    Posted Fri October 28, 2022 09:02 AM
    Hi,

    I have the same error with an oracle driver.
    If I start the model with the approach above it works.
    Setting ODMS_JAVA_ARGS in cmd:
    c:\> set ODMS_JAVA_ARGS=-classpath /path/to/your/driver.jar
    c:\> oplrun yourmodel.mod yourmodel.dat

    But when I start the model from IBM ILOG CPLEX Optimization Studio I get the same error:
    Description:
    Exception from IBM ILOG Concert: No suitable driver found for jdbc:oracle:thin:user/pw@database).
    Type:
    OPL Problem Marker

    Is there a possibility to start the model from the studio.
    The Studio does not seem to use the ODMS_JAVA_ARGS path.


    Best regards
    Mandy Klemmt


    ------------------------------
    Mandy Klemmt
    ------------------------------