The code is:


//Connect to MySql Server
   try {
         Class.forName("org.gjt.mm.mysql.Driver").newInstance();
   }
   catch(Exception e){
            System.out.println("Can not get class Name");
   }
   
 try {
               c = DriverManager.getConnection
("jdbc:mysql://localhost/dbname?user=username&password=mypasswd");
      }
catch (SQLException se){System.out.println("trouble to connect");}//



 I can connect to a mysql server in a remote machine by
changing localhost to a url (the
server is set by other people and i do not kown how he set it)  
But when I run this code and try to connect to  the local mysql server i
get error message "trouble to connect"?
I can create databases and tables in my local mysql without any problem.

Can somebody give me a suggestion? Thanks in advance.

btw I have redhat 7,2 os.

JP




_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to