• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

JDBC MySQL will not connect (but MySQL Administrator will)

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am close to the stage of growing some hair on my bold head and then ripping them out.
I really can't figure out what is going on, but the situation is like this:
1) MySQL server #1 is located on the remote machine (Version 4.0.24);
2) MySQL server #2 is located on my local machine (Version 5.1.11);
3) Servers have identical schemas;
4) I am using Sun JDK1.6.0_04;
5) I am using MySQL� Connector/J 5.1;
6) I can connect to BOTH servers via MySQL Administrator!;
7) I can connect ONLY to server #2 via JDBC;
8) When trying to connect ot server #1 via JDBC, getConnection() hangs up, and if ConnectionTimout and SocketTimeout are explicitly specified, connection timeout exception is then thrown;

I have tried modifying connection string in various ways, even SSH TUNNELING to the remote server, but no result. And MySQL Administrator just works without ANY problems!
I have a feeling there must be something crucial that I am missing.
Could anyone help? Thank you in advance.
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

MySQL server #1 is located on the remote machine (Version 4.0.24);
2) MySQL server #2 is located on my local machine (Version 5.1.11);
...
5) I am using MySQL� Connector/J 5.1;

By reading the Connector/J's doc, I can see that 5.1 supports MySQL 4.1 and higher.

Connector/J 5.1 is the Type IV pure Java JDBC driver and provides compatibility with all the functionality of MySQL, including 4.1, 5.0, 5.1 and the 6.0 alpha release



While Administrator can connect to 4.0.24 and 5.1.11, your version of the jdbc library seems to fail. Try using a jdbc driver that is compatible with 4.0.24.

Regards, Jan
[ February 29, 2008: Message edited by: Jan Cumps ]
 
Stepan Kolesnik
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jan,

Thank you, you were right. I used SQL Connector v5.0.8 and it worked. Strange, though, because even reading from MySQL website it is ambiguous which Connectors supports which MySQL versions:

  • Connector/J 5.1 is the Type IV pure Java JDBC driver and provides compatibility with all the functionality of MySQL, including 4.1, 5.0, 5.1 and the 6.0;
  • Connector/J 5.0 provides support for all the functionality offered by Connector/J 3.1 and includes distributed transaction (XA) support.;
  • Connector/J 3.1 was designed for connectivity to MySQL 4.1 and MySQL 5.0 servers and provides support for all the functionality in MySQL 5.0 except distributed transaction (XA) support;

  • So I cannot see what Connector v5.0 can do that Connector v5.1 cannot =\ The only difference between them is that 5.0 does not support MySQL v5.1 and v6.0. Very weird..

    Regards,
    Stepan
     
    Can you smell this for me? I think this tiny ad smells like blueberry pie!
    We need your help - Coderanch server fundraiser
    https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    reply
      Bookmark Topic Watch Topic
    • New Topic