Decision Optimization

 View Only
  • 1.  No suitable driver found for jdbc:sqlite

    Posted Fri December 18, 2020 06:06 PM

    I am trying to use the new OPL 20.1 framework that allows OPL to read data from databases using statements in a .dat file. Nonetheless, when I follow the guides and set an environment variable ODMS_JAVA_ARGS, and try to run my code I get the following error:

    "No suitable driver found for jdbc:sqlite"

    What could I be doing wrong?

    I am following this  guide: IBM Data Science Community - IBM Data Science Community

    Ibm remove preview
    IBM Data Science Community - IBM Data Science Community
    The site home page
    View this on Ibm >

     



    ------------------------------
    Juan David Zambrano
    ------------------------------

    #DecisionOptimization


  • 2.  RE: No suitable driver found for jdbc:sqlite

    Posted Wed December 23, 2020 10:21 AM

    Hello,

    I'm afraid that the question is too generic. Could you give us more details? What operation system are you using? What version of the database etc? Could you copy what exactly you're doing and what response you get?

    Thanks, Petr



    ------------------------------
    Petr Vilím
    IBM
    ------------------------------



  • 3.  RE: No suitable driver found for jdbc:sqlite

    Posted Wed December 23, 2020 01:17 PM

    Hi Peter,

    When using CPLEX 12.9 on my windows 64 laptop to connect to a SQL server 2016 database under a security protocol TLS1.2, I will have the below statements

     includeScript("jdbc.js");
     var CD_COATDB_CPLEX = JDBCConnector("jdbc:sqlserver://ServerName\\InstanceName;port=XXXXX;databaseName=DBName;integratedSecurity=true");

    What would be the connection string if I have to use CPLEX 20.1 to connect to the same database DBName on the serverServerName, instance  InstanceName and port XXXXXX?

    Thanks,



    ------------------------------
    Nourredine Hail
    ------------------------------



  • 4.  RE: No suitable driver found for jdbc:sqlite

    Posted Tue January 05, 2021 11:33 AM
    Hello Peter, 

    I am currently working with OPL 20.1 on a windows 64 laptop. The database I am trying to connect to is a sqlite 3.33.0 local database, using a sqlite 3.27.2 JDBC driver. 

    The method I am using to read the database into OPL is using statements in a .dat file, the code is shown below: 

    JDBCConnection conn("jdbc:sqlite:product_data.db",
                        "DROP TABLE IF EXISTS results; CREATE TABLE results (Product VARCHAR, Inside INTEGER, Outside INTEGER)");

    Products from JDBCRead(conn, "SELECT name, demand, insideCost, outsideCost, consumptionFlour, consumptionEggs FROM products");
    Results to JDBCPublish(conn, "INSERT INTO results VALUES(?, ?, ?)");

    In addition to this, the JDBC driver is downloaded and set as an environment variable ODMS_JAVA_ARGS 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: 

    No suitable driver found for jdbc:sqlite:product_data.db.

    I have also tried with a database locally hosted with MySQL 8.0.22 and the respective driver with the same results. 

    Thanks,

    ------------------------------
    Juan David Zambrano
    ------------------------------



  • 5.  RE: No suitable driver found for jdbc:sqlite

    Posted Mon February 01, 2021 09:13 AM
    Hello, 

    I am still having this issue when trying to connect to the database. Given the details, including OS and version of the database, is it possible that something is wrong with my  approach? Or am I missing something? 

    Thanks, 


    ------------------------------
    Juan David Zambrano
    ------------------------------



  • 6.  RE: No suitable driver found for jdbc:sqlite

    Posted Tue February 02, 2021 08:53 AM
    Hi

    as a workaround you could use an old workaround : https://community.ibm.com/community/user/datascience/communities/community-home/digestviewer/viewthread?MessageKey=b32b50bb-15c5-41ab-9f66-cd090918ed5b&CommunityKey=ab7de0fd-6f43-47a9-8261-33578a231bb7&tab=digestviewer#bmb32b50bb-15c5-41ab-9f66-cd090918ed5b

    regards

    ------------------------------
    [Alex] [Fleischer]
    [EMEA CPLEX Optimization Technical Sales]
    [IBM]
    ------------------------------