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



---------------------------------------------------------------------
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