Connect to SQLDirectLddd JDBC

I installed Microsoft SQL Server 2012 Express localdb on my system.

After I created (and started) the instance (Test) with the database (db1), I tried to connect to my java-Applikation.

The driver ist "com.microsoft.sqlserver.jdbc.SQLServerDriver".

My connection string is: "jdbc: sqlserver: // (localdb) \ Test; databaseName = db1; schema = db1;"

Error (truncated): java.net.UnknownHostException: '(localdb)' named instance 'Test' Check UDP port 1434 Check if the SQL Server service browser is running

My version of .NET Framework 4.0.2

'SQLCMD.EXE -S (localdb) \ Test' works fine.

How can I solve this problem?

+6
source share
1 answer

The Microsoft SQL Server JDBC driver does not support localDB. See Comment http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx#10250447

Krzysztof Kozelczyk - MSFT Dec 22, 2011 11:10 AM #

@Charles Stanton

Unfortunately, the JDBC driver does not support LocalDB at the moment and there is no easy solution. The team is aware of this shortcoming, but recording a connection element is always useful for DCR tracking and prioritization.

Thanks,

-Krzysztof

As explained by the answer in Connecting to SQL Server LocalDB using JDBC , this can be done using the jTDS driver.

+5
source

Source: https://habr.com/ru/post/922161/


All Articles