View Single Post
  #1 (permalink)  
Old May 24th, 2004, 10:22 AM
pekj pekj is offline
Registered User
 
Join Date: May 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    } 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);
        stmt.close();
        con.close();
    }
      catch(SQLException e)
       {sqlStreng = e.getMessage();}

%>



Reply With Quote