#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    1
    Rep Power
    0

    MYSQL connection to JSP (not again!! :) )


    Hi all

    Here's the recurring problem - how do I connect Mysql to JSP on a tomcat server. I have seached a lot of forums and spent hours on manuals but can't seem to have my connection running, any help would be most appreciated...

    Here's my setup:
    I am testing on my PC.
    WindwsXP, Tomcat Server 4.1.29, J/Connect 3.1, and MYSQL

    Here's the problem:

    I am trying to get the most basic connection happening but to no avail:


    %@ page language="java" contentType="text/html" import="java.sql.*,java.awt.*" %>
    <%
    //load the MySQL JDBC driver
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");


    Connection con = DriverManager.getConnection("jdbcdbc:tododb","","");

    %>

    As soon as I have "Connection con = ...." uncommented, I get the following error: type Exception report

    " message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    .......
    "

    Now I am not sure what I am doing wrong, as I have already set my Classpath, added the .jar file to my working directory, and to WEB_INF/lib directory, but still the same error is happening.

    Question: Which class should I be using? JDBC, ORG, COM?

    I just ned a way to start this connection, any help will be most appreciated.

    Regards
    JSP_neubee
  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,517
    Rep Power
    542
    You are using the JDBC-ODBC bridge from SUN to connect to MySQL and it doesn't work as you don't have the appropriate ODBC datasource set up.
    You should really take some time to read MySQL Connector/J docs.
    Last edited by pabloj; January 20th, 2004 at 09:43 AM.

IMN logo majestic logo threadwatch logo seochat tools logo