Feb 27, 2018 Download the Microsoft JDBC Driver 6.0 for SQL Server. • Microsoft SQL Server 2008 R2 • Microsoft SQL Server 2008 • Azure SQL Database.
Microsoft Sql 2008 R2
My configuration:
- windows XP SP3
- JDBC 2005
- MS SQL Server 2008 Express, exposed via tcp/ip on port 1433
- sqljdbc.jar in class path
Ms Sql 2008 R2 System Requirements
I tried:
But it always throws an exception:
I also tried the following urls:
Same results. Any help?
Cheeso6 Answers
You have the wrong URL.
I don't know what you mean by 'JDBC 2005'. When I looked on the microsoft site, I found something called the Microsoft SQL Server JDBC Driver 2.0. You're going to want that one - it includes lots of fixes and some perf improvements. [edit: you're probably going to want the latest driver. As of March 2012, the latest JDBC driver from Microsoft is JDBC 4.0]
Check the release notes. For this driver, you want:
It seems you have the class name correct, but the URL wrong.
Microsoft changed the class name and the URL after its initial release of a JDBC driver. The URL you are using goes with the original JDBC driver from Microsoft, the one MS calls the 'SQL Server 2000 version'. But that driver uses a different classname.
For all subsequent drivers, the URL changed to the form I have here.
This is in the release notes for the JDBC driver.
CheesoCheeso- Download the latest JDBC Driver (i.e.
sqljdbc4.0
) from Microsoft's web site Write the program as follows:
Compile the program and set the jar classpath viz:
set classpath=C:jdbcsqljdbc4.jar;.;
If you have saved yourjar
file inC:jdbc
after downloading and extracting.- Run the program and make sure your TCP/IP service is enabled. If not enabled, then follow these steps:
- Go to Start -> All Programs -> Microsoft SQL Server 2008 -> Configuration tools -> SQL Server Configuration Manager
- Expand Sql Server Network Configuration: choose your MS SQL Server Instance viz. MSQSLSERVER and enable TCP/IP.
- Restart your MS SQL Server Instance. This can be done also from the right click menu of Microsoft SQL Server Management Studio at the root level of your MS SQL server instance
If your databaseName
value is correct, then use this: DriverManger.getconnection('jdbc:sqlserver://ServerIp:1433;user=myuser;password=mypassword;databaseName=databaseName;')
The latest JDBC MSSQL connectivity driver can be found on JDBC 4.0
Download Sql 2008 R2 Standard
The class file should be in the classpath. If you are using eclipse you can easily do the same by doing the following -->
Right Click Project Name --> Properties --> Java Build Path --> Libraries --> Add External Jars
Also as already been pointed out by @Cheeso the correct way to access is jdbc:sqlserver://server:port;DatabaseName=dbname
Meanwhile please find a sample class for accessing MSSQL DB (2008 in my case).
Hope this helps.
![Ms sql server 2012 jdbc driver download Ms sql server 2012 jdbc driver download](http://i.stack.imgur.com/3NEaE.png)
Named instances?
URL: jdbc:sqlserver://[serverName][instanceName][:portNumber][;property=value]
Ms Sql 2008 R2 Sp4
Note: backward slash
You can try the following. Works fine in my case:
- Download the current jTDS JDBC Driver
- Put jtds-x.x.x.jar in your classpath.
- Copy ntlmauth.dll to windows/system32. Choose the dll based on your hardware x86,x64...
- The connection url is: 'jdbc:jtds:sqlserver://localhost:1433/YourDB' , you don't have to provide username and password.
Ms Sql Server 2012 Jdbc Driver Jar Download
Hope that helps.