• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DriverManager.getConnection tries in vain to connect

 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rudy Dakota
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
juliane gross
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic