It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Java Forum

MS SQL Connection (Local Server)

MS SQL Connection (Local Server)

Postby skaa on Fri Dec 29, 2006 3:25 pm

How to connect to local sever through JDBC?
I try:
DriverManager.getConnection("jdbc:microsoft:sqlserver://(local);databasename=Test","sa","");
, but have the Exception
[Microsoft][SQLServer JDBC Driver]Unable to connect. Invalid URL.
Thanx!
User avatar
skaa
 
Posts: 4
Joined: Thu Dec 21, 2006 1:48 pm
Location: Morton Grove, IL, USA

Postby ngpgeeta on Sun Dec 31, 2006 8:13 am

What I have understood you have to connect to database test of SQL server.

First try to make a driver with SQLServer using odbc data sources (32 bit) of your systems control panel. In that, in system dsn, make a driver for sql server. Connect your database test with that driver.
Once you have made a driver with test database, in your coding write

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn= DriverManager.getConnection("jdbc:odbc:test","sa","");

Hope this helps!
ngpgeeta
 
Posts: 19
Joined: Sat Nov 18, 2006 11:30 am

Postby skaa on Tue Jan 09, 2007 3:13 pm

Thank you! It helped.
User avatar
skaa
 
Posts: 4
Joined: Thu Dec 21, 2006 1:48 pm
Location: Morton Grove, IL, USA


Who is online

Users browsing this forum: No registered users and 2 guests