Android Question JTDS No suitable driver found for

Tamer El-Shimy

Member
Licensed User
Longtime User
What I'm doing wrong to get the following exception ?
java.sql.SQLException: No suitable driver found for http://jdbc:jtds:SQLServer://10.29.1.82:1433;DatabaseName=KPI;IntegratedSecurity=False;Username=MySQLUsername;Password=MySQLPassword

[CODE lang="b4x" title="B4A part"]Public Sub ConnectDB
Driver="net.sourceforge.jtds.jdbc.Driver"
Dim SIP ,SPort As String
SIP="10.29.1.82"
SPort="1433"
Username=MyUsername
Password=MyPassword
URL="http://jdbc:jtds:SQLServer://" & SIP &":" & SPort & ";DatabaseName=KPI;IntegratedSecurity=False;Username="& Username & ";Password=" & Password
Log (Driver)
MySQL.Initialize2(Driver, URL,Username,Password)
Log ("Initialization : " & MySQL.IsInitialized)
End Sub[/CODE]

[CODE lang="b4x" title="Additional Jar"]#AdditionalJar :JdbcSQL.jar
#AdditionalJar :jtds-1.3.1.jar[/CODE]
Keeping in mind the code worked for another test application
 
Keeping in mind the code worked for another test application
Does that other test application still work now because the jar is from 2013 and Microsoft sql server (6.5, 7, 2000, 2005, 2008 and 2012) are all old versions and as far as I can seen, not longer supported version.

How to Connect to MS SQL Server via JDBC is stated:
Newer versions of MS SQL Server, especially those that use SSL encryption to communicate to and from the database server, may not work correctly with the jTDS driver. There are some issues with the jTDS driver, the Jave runtime environment, and the handling of SSL/TLS communications with certain SQL Server configurations. If the jTDS driver is not able to connect, generally the MS SQL Server driver from Microsoft will work. The only major difference between the two drivers is that when connecting to SQL Server from non-Windows systems, the MS SQL Server driver does not support Windows authentication. It requires SQL Server authentication. The jTDS driver does support Windows authentication from non-Windows systems.
 
Upvote 0
Does that other test application still work now because the jar is from 2013 and Microsoft sql server (6.5, 7, 2000, 2005, 2008 and 2012) are all old versions and as far as I can seen, not longer supported version.

How to Connect to MS SQL Server via JDBC is stated:
Really I'm having a test application with a button which uses initialize2 and another button uses initializeasync ( both work with proper queries or error messages of Success : False) , The only difference is that I added the username , password ,url , and port manually for the test application not including variables.

Anyway , I've these references commented out :
''#AdditionalJar :mssql-jdbc-10.2.0.jre8
''#AdditionalJar :mssql-jdbc-10.2.0.jre11
''#AdditionalJar :mssql-jdbc-10.2.0.jre17
 
Upvote 0
I would say take the test application as a starting point and run to see if the original test application with your current IDE environment still works. If so and it doesn't work with password and username then it is the authentication problem. The RazorSQL link I gave earlier addresses login issues.
 
Upvote 0
Anyway , I've these references commented out :
''#AdditionalJar :mssql-jdbc-10.2.0.jre8
''#AdditionalJar :mssql-jdbc-10.2.0.jre11
''#AdditionalJar :mssql-jdbc-10.2.0.jre17
Is this a finger point to Java version dependency?
 
Upvote 0
The test Application is still working , I just tried to add the variables of IP address of the DB server , Port , Username , Password and merge them with my original application.
 
Upvote 0
URL="http://jdbc:jtds:SQLServer://" & SIP &":" & SPort & ";DatabaseName=KPI;IntegratedSecurity=False;Username="& Username & ";Password=" & Password

Try:
B4X:
URL="jdbc:jtds:sqlserver://" & SIP & ":" & SPort & ";DatabaseName=KPI;IntegratedSecurity=False"
 
Upvote 0
unsupported class file version 61.0
...while parsing com/microsoft/sqlserver/jdbc/AASAttestationParameters.class
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:692)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:315)
at com.android.dx.command.dexer.Main.runDx(Main.java:293)
at com.android.dx.command.dexer.Main.main(Main.java:249)
at com.android.dx.command.Main.main(Main.java:94)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:684)
... 4
 
Upvote 0
This is why I tried to use another SDK version.

unsupported class file version 61.0
...while parsing com/microsoft/sqlserver/jdbc/AASAttestationParameters.class
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:692)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:315)
at com.android.dx.command.dexer.Main.runDx(Main.java:293)
at com.android.dx.command.dexer.Main.main(Main.java:249)
at com.android.dx.command.Main.main(Main.java:94)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:684)
 
Upvote 0
What if you remove this line?
Really I wanted to try the "com.microsoft.SQLServer.SQLServerDriver" after the "net.sourceforge.jtds.jdbc.Driver" succeeded in Test application but failed to merge it in my application. Where Can I put "sqljdbc_10.2" folder?
 
Upvote 0
Does that other test application still work now because the jar is from 2013 and Microsoft sql server (6.5, 7, 2000, 2005, 2008 and 2012) are all old versions and as far as I can seen, not longer supported version.

How to Connect to MS SQL Server via JDBC is stated:
Ok , Where to put the folder "sqljdbc_10.2" for "com.microsoft.SQLServer.jdbc.SQLServerDriver" and URL of "jdbc:SQLServer://"?
 
Upvote 0
Back
Top