Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the jTDS JDBC Connect URL to MS SQL Server 2005 Express

I'm trying to connect to a MS SQL Server 2005 Express database that is running on the local host from a java program.

I have tried the same connect URL (below) that I used on another system (same jave code) that was running MS SQL Server 2000. But that does not work.

jdbc:jtds:sqlserver://127.0.0.1:1433/Finance

Any ideas?

like image 698
Ron Tuffin Avatar asked Jun 25 '09 20:06

Ron Tuffin


People also ask

What is the connection URL for SQL Server?

jdbc:sqlserver:// (Required) is known as the subprotocol and is constant. serverName (Optional) is the address of the server to connect to. This address can be a DNS or IP address, or it can be localhost or 127.0. 0.1 for the local computer.

What is JTDS JDBC?

jTDS is an open source 100% pure Java (type 4) JDBC 3.0 driver for Microsoft SQL Server (6.5, 7, 2000 and 2005) and Sybase (10, 11, 12, 15). jTDS is based on FreeTDS and is currently the fastest production-ready JDBC driver for microsoft SQL Server and Sybase.


1 Answers

Are you sure it is the correct instance? SQL Express tends to install as named instance, like "localhost\SQLExpress", instead of a standard instance. So it would be something like:

jdbc:jtds:sqlserver://127.0.0.1:1433/Finance;instance=<instance_name>

If this doesn't work, try dropping the instance name, and changing the port to the port used by the named instance:

jdbc:jtds:sqlserver://127.0.0.1:<instance_port>/Finance

Else try to check your connectivity through OSQL.exe tool first. You can also check the jTDS FAQ on this.

like image 165
MicSim Avatar answered Sep 23 '22 16:09

MicSim