Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Connecting to MS SQL problems

 
   Database Help (Home) -> Java RSS
Next:  resultset is an iterator?  
Author Message
yelp666

External


Since: May 19, 2004
Posts: 1



(Msg. 1) Posted: Wed May 19, 2004 5:40 pm
Post subject: Connecting to MS SQL problems
Archived from groups: comp>lang>java>databases (more info?)

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
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

 >> Stay informed about: Connecting to MS SQL problems 
Back to top
Login to vote
kaeli1

External


Since: Jan 16, 2004
Posts: 15



(Msg. 2) Posted: Thu May 20, 2004 10:19 am
Post subject: Re: Connecting to MS SQL problems [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <yelp666.16iso1 DeleteThis @mail.codecomments.com>, yelp666.16iso1
@mail.codecomments.com enlightened us with...
 >
 > 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.
 >

You forgot to register the driver with DriverManager.


--
--
~kaeli~
She was engaged to a boyfriend with a wooden leg but broke
it off.
<a style='text-decoration: underline;' href="http://www.ipwebdesign.net/wildAtHeart" target="_blank">http://www.ipwebdesign.net/wildAtHeart</a>
<a style='text-decoration: underline;' href="http://www.ipwebdesign.net/kaelisSpace" target="_blank">http://www.ipwebdesign.net/kaelisSpace</a><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Connecting to MS SQL problems 
Back to top
Login to vote
Luke Webber

External


Since: Jan 23, 2004
Posts: 18



(Msg. 3) Posted: Thu May 20, 2004 12:08 pm
Post subject: Re: Connecting to MS SQL problems [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"yelp666" <yelp666.16iso1 DeleteThis @mail.codecomments.com> wrote in message
news:yelp666.16iso1@mail.codecomments.com...
 >
 > 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.

I would recommend that you use the JTDS JDBC driver instead of JDBC.

<a style='text-decoration: underline;' href="http://jtds.sourceforge.net/" target="_blank">http://jtds.sourceforge.net/</a>

Luke<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Connecting to MS SQL problems 
Back to top
Login to vote
Eric7

External


Since: Jun 11, 2004
Posts: 1



(Msg. 4) Posted: Fri Jun 11, 2004 6:42 pm
Post subject: Re: Connecting to MS SQL problems [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.



"kaeli" <tiny_one.TakeThisOut@NOSPAM.comcast.net> wrote in message
news:MPG.1b165e60c8a88f79989e64@nntp.lucent.com...

 > In article <yelp666.16iso1.TakeThisOut@mail.codecomments.com>, yelp666.16iso1
 > @mail.codecomments.com enlightened us with...
  > >
  > > 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.
  > >
 >
 > You forgot to register the driver with DriverManager.
 >
 >
 > --
 > --
 > ~kaeli~
 > She was engaged to a boyfriend with a wooden leg but broke
 > it off.
<font color=purple> > <a style='text-decoration: underline;' href="http://www.ipwebdesign.net/wildAtHeart</font" target="_blank">http://www.ipwebdesign.net/wildAtHeart</font</a>>
<font color=purple> > <a style='text-decoration: underline;' href="http://www.ipwebdesign.net/kaelisSpace</font" target="_blank">http://www.ipwebdesign.net/kaelisSpace</font</a>>
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Connecting to MS SQL problems 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
trouble connecting to mysql - hello friends i have just touched jsp programming and i m having trouble connecting to mysql database. I m using tomcat 6 the connection part of the code of my jsp (HelloMySql.jsp) is--> ______________________________________________________ <%@ p...

SQLServer 2000 Driver for JDBC behaviour on SQL Server res.. - 1) My java code properly connects to the SQL Server DB via the SQL Server 2000 JDBC driver. 2) During one of our stress tests, we restarted the SQL Server to see how the code handles it. 3) My code doesn't really recognize that the SQL server is up and m...

Displaying contents from database in an applet - I have created a connection to an MSAccess database, but I am unable to display the results in an webbrowser. My question is therefore how do I retrieve and displaty the records of my database on a webpage? Kind regards Johan Reimers

Hibernate and log4j config under Tomcat. - "Under Tomcat 3.x and 4.x, you should place the log4j.properties under the WEB-INF/classes directory of your web-applications. Log4j will find the properties file and initialize itself. This is easy to do and it works." "The XML configu...

Java &amp; MySQL show table status command - Hi, I am using java to retrieve a resultset with "show table status" mysql command. I am having problem reading the [name] and [engine] column. In the metadata object it is showing as VARCHAR but when I do getString() it is returning me the o...
   Database Help (Home) -> Java All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]