Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2004, 10:22 AM
Registered User
 
Join Date: May 2004
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();}

%>



 
Old June 1st, 2004, 04:54 AM
Authorized User
 
Join Date: Feb 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to cash
Default

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






Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection String to MS ACCESS jmss66 Classic ASP Databases 4 January 24th, 2008 06:54 PM
MS Access to SQL server connection imaley Access VBA 3 February 16th, 2007 01:59 PM
Connection Pool on MS Access? Edward King Java Databases 1 August 3rd, 2005 12:48 AM
ms access database connection android66 Javascript 1 December 1st, 2004 07:19 AM
Help with ASP and MS ACCESS. Connection error. patzblue Access ASP 7 September 11th, 2004 05:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.