suggestions:
1. try without creating a new instance for the driver
2. change the DriverManager method to include user name and password. Try
using DriverManager.getConnection(url , username , password)

Deepak

-----Original Message-----
From: Brian Mrkonjic [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 27, 2000 12:35 PM
To: [EMAIL PROTECTED]
Subject: Problem connecting to MS Access database on NT using ODBC
bridge


Hi,

I have encountered a problem when attempting to connect to a MS Access
database hosted on an NT Server running JRun using a servlet. I have created
an ODBC datasource for the Access database on the NT server.

I first used a simple Java program to connect to the database and output
some records from a table. It executed successfully.

I then used the identical code in a simple servlet. The code snippet for
connecting to the database is as follows:

     // The name of the JDBC driver to use
     String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";

     // The JDBC connection URL
     String connectionURL = "jdbc:odbc:MyAccessDataSource";

     try {

        // Create an instance of the JDBC driver so that it has
        // a chance to register itself
        Class.forName(driverName).newInstance();

        // Create a new database connection.
        con = DriverManager.getConnection(connectionURL);

        ...

At this point in the execution, I get the following error message:

Exception! java.sql.SQLException: [Microsoft][ODBC Microsoft Access
Driver]General error Unable to open registry key 'DriverId'. at
sun.jdbc.odbc.JdbcOdbc.createSQLException(Compiled Code) at
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:4246) at
sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:1136) at
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:148) at
sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:167) at
java.sql.DriverManager.getConnection(Compiled Code) at
java.sql.DriverManager.getConnection(DriverManager.java:159) at
EmployeeList.query(EmployeeList.java:148) at
EmployeeList.doGet(EmployeeList.java:66) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:516) at
javax.servlet.http.HttpServlet.service(Compiled Code) at
com.livesoftware.jrun.JRun.runServlet(Compiled Code) at
com.livesoftware.jrun.JRunGeneric.handleConnection(Compiled Code) at
com.livesoftware.jrun.JRunGeneric.handleProxyConnection(Compiled Code) at
com.livesoftware.jrun.service.proxy.JRunProxyServiceHandler.handleRequest(Co
mpiled
Code) at com.livesoftware.jrun.service.ThreadConfigHandler.run(Compiled
Code)


Any help/insights would be appreciated,

Brian
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

___________________________________________________________________________
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