B4J Question Connecting to MS SQL Timeout

Patrick Clark

Active Member
Licensed User
Hi

I am trying to connect to a MS SQL server.

I have the
B4X:
    #AdditionalJar: jtds-1.3.1.jar
along with the jar file in Additional Libraries

With SMSS I can connect with 192.168.1.145\SQLEXPRESS where I have a database called test

if I try and connect with
B4X:
    Private SQL1 As SQL  'in Class Globals or Process Globals

    SQL1.Initialize2("net.sourceforge.jtds.jdbc.Driver", "jdbc:jtds:sqlserver://192.168.1.145/SQLEXPRESS/test", "user", "password")

I get the following timeout error in the logs.

Any ideas?

 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
After you migrate instead of using /sql express use :1433 (open tcp port in sql server configuration manager)
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Use the MS SQL JDBC driver as suggest by @Enrique Gonzalez R . As to the JDBC driver and JDBC URL, you could try
B4X:
SQL1.Initialize2("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://192.168.1.145;databaseName=test", "user", "password")

for more information on how to construct the JDBC URL for the MS SQL JDBC driver, see:

If you use the default port of 1433, you usually don't have to included it in the URL. The same goes for the instance name (as per above provided link).
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…