p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   JSP Basics (http://p2p.wrox.com/forumdisplay.php?f=92)
-   -   Can't get connection to MS Access (http://p2p.wrox.com/showthread.php?t=13347)

pekj May 24th, 2004 10:22 AM

Can't get connection to MS Access
I'm new to JSP and trying to use MS Access (2002) form a Tomcat server (5.0.25). I'm using Windows XP.

The problem is, that the method getConnection on the class DriverManager fails with the error message:

"The Data Source wasn't found, and there is no standard driver"

Here is the line:

con = DriverManager.getConnection("jdbc:odbc:DbMedlem", "", "");

I have created an ODBC data source (DbMedlem) in the XP Control Panel, and it works all rigth.

Can anybody please help??????

Here is the relevant code:

    Connection con; // forbindelse til database
    Statement stmt; // sql-sætning
    String sqlStreng;

    try { // Load jdbc-odbc-driver
    } catch (ClassNotFoundException e)
    {System.err.println("ClassNotFoundException: " + e.getMessage());}

    sqlStreng = "INSERT INTO Medlem(Navn,Adresse,Postnr,Telefonnr,Email,Medlems type,Boldkanon,Nøgle,Kommentar) ";
    sqlStreng += "VALUES('aa','aa',5000,'aa','aa','aa','aa','aa','a a')";

    con = null;
    try {
        con = DriverManager.getConnection("jdbc:odbc:DbMedlem", "", "");
        stmt = con.createStatement();
        postnrInt = stmt.executeUpdate(sqlStreng);
      catch(SQLException e)
       {sqlStreng = e.getMessage();}


cash June 1st, 2004 04:54 AM

please check you odbc data source and make you data source name(DbMedlem) was the only one and the name was right.

All times are GMT -4. The time now is 07:01 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.