Hi try this:

   try
    {
      //load JDBC-ODBC Bridge driver
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      //establish database connection to sql_svr using ODBC
      dbConn =
DriverManager.getConnection("jdbc:odbc:sql_svr","Administrative", "admin");
    }
    catch (ClassNotFoundException e) //Class.forName throws
    {
      System.out.println("JDBC-ODBC bridge not found!");
      return;
    }
    catch (SQLException e) //DriverManager.getConnection throws
    {
      System.out.println("Unable to open database!");
      return;
   /
  }

Jim

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Michael Chung
Sent: Sunday, November 07, 1999 7:37 PM
To: [EMAIL PROTECTED]
Subject: MS SQL Server and JDBC question

Hi everybody,

I tried to run a servlet example called 'coffee.java'.  (See attached
code sample)
My problem is I don't know how to put the correct odbc driver for this
line of code:
...
try {
    Class.forName("jdbc.odbc.JdbcOdbcDriver");  // ( I've got error on
this.)
                             ^^^^^^^^^^^^^^^^^^^^^
 }
...
By the way, I'm using MS SQL Server 7.0 trial edition on windows NT 4.0.

My data source name = 'sql_svr'
My Database name='mydb'
My table name='myInfo'
My login ID='Administrative'
My password='admin'

Does anybody have succeeded to connect to a Microsoft SQL Server
database using servlet?
If so could you give me an example?
Really much appreciated.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to