Hi all,
I am trying to connect to MS SQL Server installed on my computer, I
follow the tutorial, that can be downloaded from sun's web page, but it
doesn't work. Whatever I try, I get the seme error:
ODBC Driver Menager: Unable to locate the name of data origin, and
there are no default drivers.
My code:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:Northwind";
java.sql.Connection con = java.sql.DriverManager.getConnection(url,
"test", "krowa");
I appreciate any help.
--
yelp666
------------------------------------------------------------------------
Luke Webber - 20 May 2004 00:08 GMT
> Hi all,
> I am trying to connect to MS SQL Server installed on my computer, I
[quoted text clipped - 12 lines]
>
> I appreciate any help.
I would recommend that you use the JTDS JDBC driver instead of JDBC.
http://jtds.sourceforge.net/
Luke
kaeli - 20 May 2004 13:19 GMT
> My code:
>
[quoted text clipped - 4 lines]
>
> I appreciate any help.
You forgot to register the driver with DriverManager.

Signature
--
~kaeli~
She was engaged to a boyfriend with a wooden leg but broke
it off.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
Eric - 11 Jun 2004 23:42 GMT
This is from the sun tutorial:
"You do not need to create an instance of a driver and register it with the
DriverManager because calling Class.forName will do that for you
automatically. If you were to create your own instance, you would be
creating an unnecessary duplicate, but it would do no harm.
When you have loaded a driver, it is available for making a connection with
a DBMS. "
What you likely have not done is go to the ODBC data source manager in the
Control Panel and create a new ODBC data source connected to the SQL Server.
If you create a data source name SqlSvr1 and set the default db to
Northwind, then use the con url "jdbc:odbc:SqlSvr1" to get the connection.
> > My code:
> >
[quoted text clipped - 6 lines]
>
> You forgot to register the driver with DriverManager.