To administer your WestHost account, please enter your
Domain Name or Server Manager Username.

WestHost: Professional Website Hosting Company








Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Sep 2004
    Posts
    3

    Default JDBC access to Mysql 3.23

    Hey, y'all.... I need some help here, and hopefully a good soul (or a bad soul in a good mood) will help me out! :?

    I am trying to access Mysql using JDBC. All I get is a "Connection refused" message. I have Linux installed in one of my home PCs, and my small application works just fine. I even installed the exact same version of Mysql, Java and Tomcat that WestHost offers, just to keep things as compatible as possible. Setting up Tomcat was fine, but I can't get the darned JDBC connection to work.

    To better isolate and research this problem, I created a very small Java program, whose only purpose in life is to connect to the database and display the contents of a test table, and I am changing all possible settings in Mysql, trying to make it work, and so far nothing, nada, zilch... same error over and over again - so it's nothing on Tomcat. I tested the same thing in my home Linux box, and it works fine.

    The fact that the program works on my local machine indicates that some configuration is out of whack in my WestHost VPS, and I can tell you right off the bat what the problem is NOT:

    - It's not bypassing the "skip-networking" in the my.cnf file. I already tried that.
    - User and password are checked and correct ( I am assuming that Mysql and Tomcat are in localhost, which I think it's safe to say is a fact )
    - It's not any other connection information - the driver name is correct, the classpath is initialized properly.
    - Oh and by the way, I DID upload the JDBC driver and its location is in the classpath
    - TCP/IP access is NOT enabled in my Mysql, but since the connection is coming from localhost, that shouldn't be necessary. Besides, PHP can access Mysql fine, which shows that Mysql is responding to a connection originated locally.

    So, this is not really a generic JDBC/Mysql question, it's a question regarding JDBC/Mysql in WestHost.

    I contacted their user support, and even though they were quick to respond and corteous, JDBC connections "are not supported at this time", as the manual so eloquently puts it. :cry:

    HELP!

    Thanks
    Rick

  2. #2
    Senior Member jalal's Avatar
    Join Date
    May 2003
    Location
    Germany
    Posts
    1,377

    Default

    Hmm, you seem to have covered most of the bases here...

    Just a couple of thoughts:

    You could turn on MySQL logging and see if there are any messages of interest:
    " MySQL Logging, this is turned on in the /etc/my.cnf file, look for the line: log = /dev/null and change it to: log = /var/log/mysqld.log There is also a MySQL error file, to found at /var/lib/mysql/mydomain.com.err, but I'm not sure what controls this."

    Remember changes to MySQL config require restarting the MySQL daemon.

    You say PHP access works, but not JDBC, is that using the same name/password? Are the grant tables in MySQL correctly setup?

    Just some ideas. And also, you maybe better off asking this question in the MySQL forums. Many people don't look this far down the page in the forum list (I'm just a bit bored this evening) and so might miss it "down here".

    Good luck and let us know if you solve it.

  3. #3
    Junior Member
    Join Date
    Sep 2004
    Posts
    3

    Default

    Hey, jalal...

    Thanks for the reply. I'm really baffled by this. I will re-post my question is the Mysql forum (is there one?!). As you can see I just started posting in this forum....

    Cheers.
    Rick

  4. #4
    Junior Member
    Join Date
    Jun 2007
    Posts
    1

    Default Any updates? I have the exact issue.

    JDBC always gives me a "connection refused" while shell connection using the same username/password is fine. It is a really roadblocker? Any success by any one? Thanks,

  5. #5
    Junior Member
    Join Date
    Jul 2007
    Posts
    13

    Default

    I have the exact same issues as above. Anyone found a solution to this or can offer new insight?

  6. #6
    Senior Member rolling's Avatar
    Join Date
    May 2004
    Location
    Different day, different place
    Posts
    486

    Default

    A quick guess would be that localhost does not resolve to your VPS, but the parent server. Try putting your domain name instead.
    Richard

    I have jotted down some of my meddlings at http://www.rollingr.net/wordpress
    Click here for a full list of formatting codes for this forum

  7. #7
    Junior Member
    Join Date
    Aug 2007
    Posts
    2

    Default got it working

    you need to have your mysql connector installed in the common/lib directory. You then need to restart tomcat so that both mysql and tomcat have this loaded. It won't work anywhere else I don't believe.

Similar Threads

  1. JDBC access to mySql
    By mfremont in forum PHP / MySQL
    Replies: 2
    Last Post: 05-02-2010, 08:38 PM
  2. Unable to uninstall MySQL 3.23 nor upgrade to MySQL 5
    By lifelinesfoundation in forum PHP / MySQL
    Replies: 1
    Last Post: 07-02-2007, 08:18 AM
  3. Replies: 3
    Last Post: 05-12-2006, 10:16 PM
  4. Replies: 16
    Last Post: 05-10-2006, 08:29 PM
  5. Replies: 19
    Last Post: 04-05-2006, 05:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •