Originally posted by: qtbgo
Hi, I want to use an open source jdbc driver to connect to MS access database in OPL. Here is what I have done.
1 unzip all ucanaccess file to my opl project folder.
2 in opl dat file :
prepare {
includeScript("jdbc.js");
// Create the jdbc custom data source
var db = JDBCConnector("jdbc:ucanaccess://D:/pythonOptimizationExample/IBMDecisionOptimization/OPL-jdbc-data-source/examples/studio_integration/oil.accdb;openExclusive=true;ignoreCase=true");
// input data
db.read("Gasolines", "SELECT NAME FROM GASDATA");
db.read("Oils", "SELECT NAME FROM OILDATA");
db.read("GasData", "SELECT * FROM GASDATA");
db.read("OilData", "SELECT * FROM OILDATA");
}
3 in "jdbc.js :
// EDIT: you want to change this for your actual driver
var jdbc_driver = "ucanaccess-4.0.4.jar"
// EDIT: specify where to look for the jdbc driver. Default is in . (besides this .js script) and in ../../external_libs
var jdbc_driver_path = ".;../../external_libs"
// EDIT: specfify where jdbc-custom-data-source is of the github project.
// default is to look in . and ../../lib
var libs = ".;../../lib";
But it doesn't work. Could someone tell me how to do it?
#DecisionOptimization#OPLusingCPLEXOptimizer