B4J Question jRDC connection to MS SQL SERVER

WadeFisher

Member
Licensed User
I've searched High and Low and have tried multiple ideas already posted.

Running jRDC: Using MySQL I have no problem connecting or working with data.
But; I am trying to get a connection to a SQL Server database and I am going in circles.

Let me first state that my Data connection to the sql server works from multiple devices using multiple programs. But I can not seem to get the connection properties right in the jRDC servlet. I am sure it is an oversight on my side but it is time for extra eyes on the code.

I have tried the "jtds" drivers and MS drivers
The jar files are in the 'Libraries' folder
There are a couple methods listed in my config file:

#SQL Server on CBDServer1
#DriverClass=net.sourceforge.jtds.jdbc.Driver
#JdbcUrl=jdbc:jtds:sqlserver:MSSQL01.carrybackdrive.com,49170/ATMBeta2

DriverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
JdbcUrl=jdbc:sqlserver:MSSQL01.carrybackdrive.com,49170/ATMBeta2
#JdbcUrl=jdbc:sqlserver://192.168.1.5,49170/ATMBeta2
User=user
Password=password
ServerPort=17178


The SQL Server port is listed after a comma because that is how it must appear in every other connection string I use in other programs. But I have tried it with the colon. Still does not work.

I've uploaded the error log from jRDC servlet.

You also see I did a connection using the Network and a connection using the URL of the sever. Both of which work in other programs.

The only code changed in the jRDC example servlet is :
B4X:
'
#Region  Project Attributes 
    #CommandLineArgs:
    #MergeLibraries: True 
#End Region
'change based on the jdbc jar file
'#AdditionalJar: mysql-connector-java-5.1.34-bin
'#AdditionalJar: jtds-1.3.1
'#AdditionalJar: sqljdbc41
#AdditionalJar: mssql-jdbc-6.4.0.jre7

I think it really is "No suitable driver" but I don't see what I am missing.
OR: the port qualifier, but I cannot seem to get that to work.
 

Attachments

  • jRDC error using coma.txt
    3.8 KB · Views: 305

npsonic

Active Member
Licensed User
Example for JTDS lib, but don't know what sql server port you are using. Is it 17178 or 49170? You mention both, but example is for port 49170.
B4X:
sql.Initialize2("net.sourceforge.jtds.jdbc.Driver","jdbc:jtds:sqlserver://192.168.1.5:49170/ATMBeta2","user","password")
 
Upvote 0

npsonic

Active Member
Licensed User
Yes, I should have read your question with greater care.

Test this, with JTDS lib

DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://127.0.0.1:49170/ATMBeta2
User=user
Password=password
ServerPort=17178
 
Upvote 0

WadeFisher

Member
Licensed User
Success!

Changed back to jtds:
Made the Additional Jar: jtds-1.3.1 , again. Put the ":" back in again
I know the ":" is more common for a port qualifier. But the SQLSever 17 connection takes a "," on all my computer Connection strings and will not work with the ":" Even though the MySql needs the ":"
I have been testing each as I go.

Also, I am not working on "local host".

Plus i added the "//" before the Web URL. Now it reads JdbcUrl=jdbc:jtds:sqlserver://MSSQL01.carrybackdrive.com:49170/ATMBeta2
I cannot put the "//" on other system conn strings.

npsonic: Thank you so much for that last push and advice. I was getting irritated and that does not help open the mind.
 
Upvote 0
Top