Android Question jRDC2 MS SQLSERVER

oscar cabrales

Member
Licensed User
Longtime User
Best Regards Erel

Please I need your help for to connect to Ms SQLserver DB with B4A using jRDC2.

the jRDC2 server is running ok with MySQL server but when I try to connect to Ms SQLserver don't function.

Attachment the screen capture to the errors

---Side server---
B4X:
#Region  Project Attributes
    #CommandLineArgs:
    #MergeLibraries: True
#End Region

'change based on the jdbc jar file
'#AdditionalJar: mysql-connector-java-5.1.44-bin
#AdditionalJar: mssql-jdbc-6.2.1.jre8

'#AdditionalJar: postgresql-9.4.1207

Sub Process_Globals
    Public srvr As Server
    Public rdcConnector1 As RDCConnector
    Public const VERSION As Float = 2.1
    Type DBCommand (Name As String, Parameters() As Object)
    Type DBResult (Tag As Object, Columns As Map, Rows As List)
End Sub

Sub AppStart (Args() As String)
    srvr.Initialize("")
    rdcConnector1.Initialize
    srvr.Port = rdcConnector1.serverPort
    srvr.AddHandler("/test", "TestHandler", False)
    srvr.AddHandler("/rdc", "RDCHandler", False)
    srvr.Start
    Log($"jRDC is running (version = $1.2{VERSION})"$)
    StartMessageLoop
End Sub

--Config.Properties--
B4X:
DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl= jdbc:jtds:sqlserver://localhost:1433/test

User=Oscar
Password=XXXXXX
ServerPort=17178


sql.select1 =select nombre,id,edad from t1 where id=1

--Log B4J Error-- side server ---
B4X:
2017-10-04 22:19:11.275:INFO::main: Logging initialized @134ms to org.eclipse.jetty.util.log.StdErrLog
oct 04, 2017 10:19:11 PM com.mchange.v2.log.MLog
INFORMACIÓN: MLog clients using java 1.4+ standard logging.
oct 04, 2017 10:19:11 PM com.mchange.v2.c3p0.C3P0Registry
INFORMACIÓN: Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
2017-10-04 22:19:11.746:INFO:oejs.Server:main: jetty-9.4.z-SNAPSHOT
2017-10-04 22:19:11.784:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
2017-10-04 22:19:11.784:INFO:oejs.session:main: No SessionScavenger set, using defaults
2017-10-04 22:19:11.786:INFO:oejs.session:main: Scavenging every 660000ms
2017-10-04 22:19:11.790:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@1282abb{/,file:///F:/ANDROID/AT1%20SQL%20SERVER%20JRDC/Server%20jRDC2%20AT1/Objects/www,AVAILABLE}
2017-10-04 22:19:11.804:INFO:oejs.AbstractNCSARequestLog:main: Opened F:\ANDROID\AT1 SQL SERVER JRDC\Server jRDC2 AT1\Objects\logs\b4j-2017_10_05.request.log
2017-10-04 22:19:11.820:INFO:oejs.AbstractConnector:main: Started ServerConnector@b1ffe6{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
2017-10-04 22:19:11.820:INFO:oejs.Server:main: Started @681ms
jRDC is running (version = 2.1)
oct 04, 2017 10:19:13 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
INFORMACIÓN: 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 -> 1hge11z9q1t2snpu1byf5kk|1e89d68, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> net.sourceforge.jtds.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hge11z9q1t2snpu1byf5kk|1e89d68, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:jtds:sqlserver://localhost:1433/test, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 1800, ma...
oct 04, 2017 10:19:13 PM com.mchange.v2.c3p0.DriverManagerDataSource
ADVERTENCIA: Could not load driverClass net.sourceforge.jtds.jdbc.Driver
java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.mchange.v2.c3p0.DriverManagerDataSource.ensureDriverLoaded(DriverManagerDataSource.java:143)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:173)
    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 04, 2017 10:19:13 PM com.mchange.v2.c3p0.DriverManagerDataSource

Test.PNG DB_sqlserver.PNG
 

OliverA

Expert
Licensed User
Longtime User
Upvote 0

OliverA

Expert
Licensed User
Longtime User
#AdditionalJar: mssql-jdbc-6.2.1.jre8
Looks like you meant to use this driver, but in the config file you are referring to the JTDS driver (or the other way arround).
 
Upvote 0
Top