I installed MySQL under Linux Suse 9.0, using the Driver Connector/J, but my Java program cannot connect to the database. The Driver works fine and MySQL is reachable by direct approach (means not via Java), as root as well as user. My java code is the same I used before (with Linux Suse 8.2), so I know that there is no general problem with the Java code.
this line finds and loads the Driver, okay. It turns out that this line:
(my url is: ) makes the program run in some endless try in vain to connect. I tried both: root with rootPassword or user with userPassword. I tried with and without the port 3306. Could there be a problem with some Linux specific permission rights? directory var/lib has: drwxr-xr-xuser=mysql, group=daemonmysql directory var/lib/mysql has: drwx------user=mysql, group=daemonmyDB drwxr-xr-xuser=mysql, group=rootmysql srwxrwxrwxuser=mysql, group=daemonmysql.sock -rw-rw----user=mysql, group=daemonmysqld.pid -rw-rw----user=mysql, group=rootmysqld.log I am not that firm in choosing the right permissions and don't want to experiment on this again (I made a mess already once..). Or should I look somwhere else completely? Thank you very much for your help! Juliane
According to the documentation (click here), if you don't specify a port it will default to 3306. If you do specify the port, it goes after the host. So try either:
I've used the former in my testing, but either should work. You can specify the user and password as part of the URL, or separately as you have done. Notice that you need a colon between "mysql" and "//". If this doesn't work, please post the error message you are getting. [ March 30, 2004: Message edited by: Wayne L Johnson ]
Hi Juliane, Just a stupid remark, perhaps, but somehow your posting suggests that you use the Operating System username/password when connecting to the database. Shouldn't that be the MySql username/password? Good riding, Rudy.
Wayne L Johnson
Joined: Sep 03, 2003
This line from Juliane's original post:
indicates that the username and password values ARE the database values. Exactly what you'd expect. Rudy, I'm not sure where the confusion over OS username/password comes from.
Joined: Jul 27, 2002
Hi there, Confusion comes form the following quote:
direct approach (means not via Java), as root as well as user.
But as I wrote, it might just be a stupid remark. Good riding, Rudy.
Joined: May 30, 2002
Thank you for your replies!
If this doesn't work, please post the error message you are getting.
Unfortunately I don't get any error message, because the program just keeps trying to connect. I have to kill the process after some while. Any more ideas are very welcome! thank you!
subject: DriverManager.getConnection tries in vain to connect