this is my code:

import java.sql.*;
import java.util.*;

public class Connected {
        public static void main (String[] args) throws Exception{
                Connection con = null;

                try{
                  String url = "jdbc:mysql://localhost:3306/mydatabase";
                        Statement stmt;
                        ResultSet rs;
                        Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                  System.out.println("Class.forName");
                        
                  con = DriverManager.getConnection(url,"root","mypasswd");
                        stmt = con.createStatement();                   
                }
                catch(SQLException e) {
                        System.out.println("Unable to load driver.");
                        e.printStackTrace();
                }
                finally{
                        if (con != null){
                                try{con.close();}
                        catch (Exception e){}
                      }
                }
        }
}

my dir structure in linux is as such: 
mysql dir -- /usr/local/mysql
mmmysql dir -- /usr/local/mysql/mmmysql
source code resides in -- /usr/local/mysql
source code able to be complied, but when run, gives the error:

Unable to load driver.
java.sql.SQLException: Invalid authorization specification: 
Access denied for user:'[EMAIL PROTECTED]'( Using password: YES)
        at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:330)
        at org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)
        at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
        at org.gjt.mm.mysql.Driver.connect(Driver.java:167)
        at java.sql.DriverManager.getConnection(DriverManager.java:517)         
        at java.sql.DriverManager.getConnection(DriverManager.java:177)
        at Connected.main(Connected.java:16)


Can anyone please help?
thks    

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to