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?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With