Hello,
use this:
public static Connection getConnection(String url,
String user,
String password)
throws SQLException
and try to write your ip-address instead of localhost
good luck
> ----------
> Von: Shao[SMTP:[EMAIL PROTECTED]]
> Antwort an: A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology.
> Gesendet: Mittwoch, 28. Februar 2001 08:02
> An: [EMAIL PROTECTED]
> Betreff: Help: jdbc for mysql
>
> Hi, all
>
> I think this is a very simple question but disturb me deeply. When i run
> these
> codes:
> import java.sql.*;
> public class LoadDriver
> {
> public static void main(String[] Args)
> {
> try {
>
> Class.forName("org.gjt.mm.mysql.Driver").newInstance();
> System.out.println("Load OK!");
> }
> catch (Exception E) {
> System.err.println("Unable to load driver.");
> E.printStackTrace();
> }
> try {
> Connection C = DriverManager.getConnection(
>
> "jdbc:mysql://localhost:3306/mydb?user=mysql&password=");
> }
> catch (SQLException E) {
> System.out.println("Error in connect");
> System.out.println("SQLException: " + E.getMessage());
> System.out.println("SQLState: " + E.getSQLState());
> System.out.println("VendorError: " + E.getErrorCode());
> }
> }
> it' output likes below:
> Load OK!
> Error in connect
> SQLException: Cannot load connection class 'java.sql.SQLException:
> Server configuration denies access to data source'.
> SQLState: 08001
> VendorError: 0
>
> Why cannot load the connection class?
> My environment is: mm.mysql.jdbc-2.0pre5 + mysql-3.23.30-gamma + jdk1.3 +
> redhat6.1 +(tomcat3.2 + apache3.12)
>
> Please help me
> Thanks
> shao
>
> __________________________________________________________________________
> _
> 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