I don't understand why you put :
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
because if you use the jdbc driver mysql.jar you have only to put :
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection con = DriverManager.getConnection
("jdbc:mysql:/qw31596:3306/MyDb","user","password");
And like that I work very well with MySql DB ..
Claude HONNORE
----- Original Message -----
From: "Francisco Jesus Castillo Pinazo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 28, 2000 3:51 PM
Subject: access to mysql using java
> Hello Friends, I´m novice in JDBC and Servlets, so i need help.
>
> I´m trying to access to a remote mysql database using java, i receive a
> error when i access, it give
> me
>
> <!-- ERROR2 -->
> <!-- ERROR2 -->
>
> that is the code i use, is correct?
>
> try
> { String urlBD =
> "jdbc:mysql://sub.dominio.net/databasename?user=miuser&password=mipass";
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> Connection conexion =
> DriverManager.getConnection(urlBD,"miuser","mipass");
> Statement select = conexion.createStatement();
> ResultSet resultadoSelect = select.executeQuery("SELECT * FROM
> tabla");
> select.close();
> conexion.close();
> } catch (SQLException e)
> { System.out.println("<!-- ERROR1 -->");
> System.out.println("<!-- " + e.getMessage() + " -->");
> } catch(Exception ex)
> { System.out.println("<!-- ERROR2 -->");
> }
>
> My CLASSPATH variable points to :
>
> :/usr/jre1.2/lib/elingo.jar::/usr/jre1.2/lib/mysql/mysql.jar:.:
>
>
> What is my problem? (.......that i´m novice)
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html