I know this post is very old, but it's the one that comes up from Google. I had the issue of not being able to get jdbc to work with OPL from within the IDE. The answer which IBM provided and which works is this:
"There is a way to make JDBCConnection work in CPLEX Optimization Studio IDE. We have tested it on Windows 10 and CPLEX IDE 20.1, 22.1 and 22.1.1 with SQL Server:
- Place the database driver jar file for JDK 8, such as mssql-jdbc-12.2.0.jre8.jar, into folder
<CPLEX_Studio>\opl\oplide\plugins\<ilog.odms.ide.opllang>
- Modify <CPLEX_Studio>\opl\oplide\plugins\<ilog.odms.ide.opllang>\META-INF\MANIFEST.MF and change the line beginning with Bundle-ClassPath as below with the file name of database driver file above:
Bundle-ClassPath: ilog.odms.ide.opllang.jar,oplall.jar, mssql-jdbc-12.2.0.jre8.jar,.
- Restart IDE, if it is already open."
Note that <ilog.odms.ide.opllang> is something like ilog.odms.ide.opllang_22.1.1.202211281837
This works with Oracle ojdbc11.jar and ojdbc17.jar.
------------------------------
Andrew Bullock
------------------------------
Original Message:
Sent: Fri October 28, 2022 08:25 AM
From: Mandy Klemmt
Subject: CPLEX Optimization 20.1 - IBM ILOG Concert: No suitable driver found for jdbc:sqlserver
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
Original Message:
Sent: Mon May 17, 2021 03:06 AM
From: Viu Long Kong
Subject: CPLEX Optimization 20.1 - IBM ILOG Concert: No suitable driver found for jdbc:sqlserver
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
Original Message:
Sent: Thu May 13, 2021 07:05 AM
From: Alexander Diaz
Subject: CPLEX Optimization 20.1 - IBM ILOG Concert: No suitable driver found for jdbc:sqlserver
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