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();}
%>
|