B4J Question jRDC: java.sql.SQLException: No suitable driver

Discussion in 'B4J Questions' started by WadeFisher, Oct 2, 2018.

  1. WadeFisher

    WadeFisher Member Licensed User

    Trying to follow the jrDC2 Tuturial but can not get past the connection trial using the browser.
    I am using the same connection string that I use on my UI program which works fine.

    The jrRDC example server is running on my development desktop, the MariaDB10 data base is running on a server on the same network.

    Here is the config.properties:
    <<--------
    #DATABASE CONFIGURATION
    DriverClass=com.mysql.jdbc.Driver
    JdbcUrl=jdbc:jdbc:mysql://192.168.1.6:3307/CBDtest
    User=MyUser
    Password=PMWYwhUHKNTiVAqu
    #Java server port, NOT the DATABASE port
    ServerPort=17178
    #example of MS SQL Server configuration:
    #DriverClass=net.sourceforge.jtds.jdbc.Driver
    #JdbcUrl=jdbc:jtds:sqlserver://<server address>/<database>
    #example of postegres configuration:
    #JdbcUrl=jdbc:postgresql://localhost/test
    #DriverClass=org.postgresql.Driver
    #SQL COMMANDS
    #sql.create_table=CREATE TABLE IF NOT EXISTS animals (\
    # id INTEGER PRIMARY KEY AUTO_INCREMENT,\
    # name CHAR(30) NOT NULL,\
    # image BLOB)
    #sql.insert_animal=INSERT INTO animals VALUES (null, ?,?)
    #sql.select_animal=SELECT name, image, id FROM animals
    sql.create_table=CREATE TABLE article (col1 numeric(10,4) ,col2 text);
    sql.select=select * from article
    sql.insert=INSERT INTO article VALUES(?, ?)
    -->>>

    Here is my working connection string in the UI program.
    <<--
    Sub AppStart (Form1 As Form, Args() As String)
    Dim sU = "MyUser" As String
    Dim sP = "PMWYwhUHKNTiVAqu" As String
    'This connection is working.
    sql.Initialize2("com.mysql.jdbc.Driver", "jdbc:mysql://192.168.1.6:3307/CBDtest",sU,sP)
    -->>

    Both programs have the Additional Jar
    #AdditionalJar: mysql-connector-java-5.1.34-bin

    The response from the web browser:
    <<--
    RemoteServer is running (10/02/2018 18:20:41)
    Error fetching connection.
    -->>

    Logs:

    2018-10-02 18:20:24.494:INFO::main: Logging initialized @148ms to org.eclipse.jetty.util.log.StdErrLog
    Oct 02, 2018 6:20:24 PM com.mchange.v2.log.MLog
    INFO: MLog clients using java 1.4+ standard logging.
    Oct 02, 2018 6:20:24 PM com.mchange.v2.c3p0.C3P0Registry
    INFO: Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
    2018-10-02 18:20:24.929:INFO:eek:ejs.Server:main: jetty-9.4.z-SNAPSHOT
    2018-10-02 18:20:24.982:INFO:eek:ejs.session:main: DefaultSessionIdManager workerName=node0
    2018-10-02 18:20:24.982:INFO:eek:ejs.session:main: No SessionScavenger set, using defaults
    2018-10-02 18:20:24.985:INFO:eek:ejs.session:main: Scavenging every 600000ms
    2018-10-02 18:20:24.991:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@3cef309d{/,file:///C:/DataVault/B4X/B4J/jRDC/Objects/www,AVAILABLE}
    2018-10-02 18:20:25.002:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\DataVault\B4X\B4J\jRDC\Objects\logs\b4j-2018_10_02.request.log
    2018-10-02 18:20:25.021:INFO:eek:ejs.AbstractConnector:main: Started ServerConnector@745d79a2{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
    2018-10-02 18:20:25.021:INFO:eek:ejs.Server:main: Started @677ms
    jRDC is running (version = 2.21)
    Oct 02, 2018 6:20:41 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
    INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 20000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1hge13o9yf827j074npwt|4aa8f0b4, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hge13o9yf827j074npwt|4aa8f0b4, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:jdbc:mysql://192.168.1.6:3307/CBDtest, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 1800, maxIdleTimeExcessConne...
    Oct 02, 2018 6:21:11 PM com.mchange.v2.resourcepool.BasicResourcePool
    WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@31cccb0c -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(DriverManager.java:315)
    at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:285)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
    at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
    Oct 02, 2018 6:21:11 PM com.mchange.v2.resourcepool.BasicResourcePool
    WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@63c35d0e -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
     
  2. WadeFisher

    WadeFisher Member Licensed User

    The UI program is NOT being used to call the jRDC2 servlet. It is just something I already have access the Database using B4J.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    There are two 'jdbc' here:
    jdbc:jdbc:mysql://192.168.1.6:3307/CBDtest
     
  4. WadeFisher

    WadeFisher Member Licensed User

    Thanks a million Erel. That was it.
    I read over the config file several times and did not notice. That is what is great about having someone else look at the same thing.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice