Hi People,
I am trying to get jRDC to work with my Microsoft SQL Server Express Data base. The database works fine with Qt C++ via a machine DNS, but I can't get it to work with jRDC. I want to get jRDC running so I can use B4X otherwise I'll have to do everything in Qt.
I based my code on Erel's examples and tutorial with mods to the config file to accommodate MS SQL Server instead of my SQL. I was going to use mySQL instead of MS SQL, but the mySQL installer won't run on my main Windows 10 machine, although it would run on my Windows 10 laptop. I also tries moriaDB, but found it was far too slow for my application where I get data in descending order top 5 values. MS SQL Server on the other hand is extremely fast both locally and on a remote machine.
My MS SQL Server is configured for TCP:
		
		
	
	
		 
	
		 
	
The connection name of the server is shown by the MS SQL Server Studio opening dialog below:
[Computer running SQL Server & jRDC2 B4J server]
		 
	
I can connect to this server using SQL Management Studio running on a remote machine, with SQL Server security credentials:
[Remote computer using TCP port 1433]
		 
	
I can run queries against the data successfully on the remote machine:
		 
	
On the server machine I have the following config file:
		 
	
When I run my browser on the server machine I get:
		 
	
So it seems that the jRDC server is running, but not connecting to the MS SQL Server DB.
The jRDC driver file I am using is jtds-1.3.1.jar which I have located in my main libraries directory.
Sysinternals TCP View shows two instances of the port 17178 connection one for TCP and one for TCPV6:
		 
	
I am pretty sure that it is my connection string that is the problem:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I had a look at the help and FAQ for the jRDC driver; these are included in the download, however there were no examples for using MS SQL Server.
The error log I get is shown below:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Does anyone have any ideas or working examples of MS SQL Server connections using jRDC2?
Best regards
Rob
			
			I am trying to get jRDC to work with my Microsoft SQL Server Express Data base. The database works fine with Qt C++ via a machine DNS, but I can't get it to work with jRDC. I want to get jRDC running so I can use B4X otherwise I'll have to do everything in Qt.
I based my code on Erel's examples and tutorial with mods to the config file to accommodate MS SQL Server instead of my SQL. I was going to use mySQL instead of MS SQL, but the mySQL installer won't run on my main Windows 10 machine, although it would run on my Windows 10 laptop. I also tries moriaDB, but found it was far too slow for my application where I get data in descending order top 5 values. MS SQL Server on the other hand is extremely fast both locally and on a remote machine.
My MS SQL Server is configured for TCP:
The connection name of the server is shown by the MS SQL Server Studio opening dialog below:
[Computer running SQL Server & jRDC2 B4J server]
I can connect to this server using SQL Management Studio running on a remote machine, with SQL Server security credentials:
[Remote computer using TCP port 1433]
I can run queries against the data successfully on the remote machine:
On the server machine I have the following config file:
When I run my browser on the server machine I get:
So it seems that the jRDC server is running, but not connecting to the MS SQL Server DB.
The jRDC driver file I am using is jtds-1.3.1.jar which I have located in my main libraries directory.
Sysinternals TCP View shows two instances of the port 17178 connection one for TCP and one for TCPV6:
I am pretty sure that it is my connection string that is the problem:
			
				Config File Connection strings:
			
		
		
		#example of MS SQL Server configuration:
DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://ROBSDESKTOP02:1433/MSSQLSERV_01;instance=SQLEXPRESS
User=rjg
Password=Toyota_b1923
#Java server port
ServerPort=17178I had a look at the help and FAQ for the jRDC driver; these are included in the download, however there were no examples for using MS SQL Server.
The error log I get is shown below:
			
				Error log:
			
		
		
		Waiting for debugger to connect...
[My comments 1: First block is when the jRDC server is started.]
Program started.
2020-05-14 12:28:49.823:INFO::JavaFX Application Thread: Logging initialized @881ms to org.eclipse.jetty.util.log.StdErrLog
May 14, 2020 12:28:49 PM com.mchange.v2.log.MLog
INFO: MLog clients using java 1.4+ standard logging.
May 14, 2020 12:28:50 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]
2020-05-14 12:28:50.995:INFO:oejs.Server:JavaFX Application Thread: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 1.8.0_131-b11
2020-05-14 12:28:51.025:INFO:oejs.session:JavaFX Application Thread: DefaultSessionIdManager workerName=node0
2020-05-14 12:28:51.026:INFO:oejs.session:JavaFX Application Thread: No SessionScavenger set, using defaults
2020-05-14 12:28:51.027:INFO:oejs.session:JavaFX Application Thread: node0 Scavenging every 660000ms
2020-05-14 12:28:51.043:INFO:oejsh.ContextHandler:JavaFX Application Thread: Started o.e.j.s.ServletContextHandler@a57b23{/,file:///G:/B4J/TestMsSql/msSqlTest/Objects/www,AVAILABLE}
2020-05-14 12:28:51.047:INFO:oejs.AbstractNCSARequestLog:JavaFX Application Thread: Opened G:\B4J\TestMsSql\msSqlTest\Objects\logs\b4j-2020_05_14.request.log
2020-05-14 12:28:51.061:INFO:oejs.AbstractConnector:JavaFX Application Thread: Started ServerConnector@f40227{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
2020-05-14 12:28:51.061:INFO:oejs.Server:JavaFX Application Thread: Started @2120ms
Emulated network latency: 100ms
jRDC is running (version = 2.22)
[END OF Comments 1]
[My Comments 2: Response when Browser is connected to local host port 17178]
May 14, 2020 12:34:51 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 -> 1hge16aaa4pxri112j2ilj|129034d, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> net.sourceforge.jtds.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hge16aaa4pxri112j2ilj|129034d, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:jtds:sqlserver://ROBSDESKTOP02:1433/MSSQLSERV_01;instance=SQLEXPRESS, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, m...
May 14, 2020 12:35:53 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@4ceed9 -- 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: Cannot open database "MSSQLSERV_01" requested by the login. The login failed.
    at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
    at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
    at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:632)
    at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
    at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
    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)
May 14, 2020 12:35:53 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@3a756c is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
May 14, 2020 12:35:54 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1315034 -- 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: Cannot open database "MSSQLSERV_01" requested by the login. The login failed.
    at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
    at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
    at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:632)
    at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
    at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
    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)
May 14, 2020 12:35:54 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@3a756c is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
May 14, 2020 12:35:54 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1e3bdb0 -- 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: Cannot open database "MSSQLSERV_01" requested by the login. The login failed.
    at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
    at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
    at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:632)
    at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
    at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
    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)
May 14, 2020 12:35:54 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@3a756c is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.Does anyone have any ideas or working examples of MS SQL Server connections using jRDC2?
Best regards
Rob
 
				 
 
		 
			 
			 
 
		 
 
		 
 
		 
			 
 
		 
 
		 
 
		 
 
		 
 
		