B4J Question My first post in Java... Help!

Tronak

Member
Licensed User
Longtime User
Hello world. I need some help:

What I need: Connect with a local MS SQL Server database.

What I have done:

Included this: #AdditionalJar: sqljdbc42.jar

Initialized the connection with: sql1.Initialize("sqljdbc42.jar", "jdbc:jtds:sqlserver://192.168.0.76\SQLEXPRESS:1433/SimpleLogs;user=USER;password=PWD")

What I got: Prrrrt.

Error occurred on line: 18 (Main)
java.lang.RuntimeException: Class not found: sqljdbc42.jar
Are you missing an #AdditionalJar attribute setting?

Anyone knows what is wrong?
 

Tronak

Member
Licensed User
Longtime User
Changed the connection to:
sql1.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://192.168.0.76\\SQLEXPRESS;databaseName=SampleLogs;user=USER;password=PWD")

And now the error changed to:

Error occurred on line: 18 (Main)
com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the host 192.168.0.76, named instance \sqlexpress failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.

Still in darkness...
 
Upvote 0

Tronak

Member
Licensed User
Longtime User
Uh. It worked. I'm a genius. A slow one.

sql1.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://192.168.0.76\SQLEXPRESS;databaseName=SampleLogs;user=USER;password=PWD")

Any other knowledge about SQL and Java you can share, will be welcome.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…