Bug #54645 | Connecting to MySql-Server from Java-Application | ||
---|---|---|---|
Submitted: | 20 Jun 2010 18:35 | Modified: | 23 Jul 2010 9:01 |
Reporter: | Patrick Miege | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.1.48 Community | OS: | Windows (Server 2003 R2 x64) |
Assigned to: | CPU Architecture: | Any | |
Tags: | long delay at first connection to mysql-server |
[20 Jun 2010 18:35]
Patrick Miege
[21 Jun 2010 6:02]
Sveta Smirnova
Thank you for the report. Do you experience same issues if connecting to remote server via MySQL command line client? Do you get performance improvement if change hostname with IP address in the Java program?
[21 Jun 2010 13:26]
Patrick Miege
Do you experience same issues if connecting to remote server via MySQL command line client? --> How can I create a remote connection from the external command line? I use the MySQL Workbench and talk to the IP using dyndns.org, but also takes a long time. Do you get performance improvement if change hostname with IP address in the Java program? --> The name is in the program for ip adrese resolved and working. See the source code. The result is no different whether the address or the host name registered with the connection try { java.net.InetAddress inetAdd = java.net.InetAddress.getByName("xyz.dyndns.org"); ip = inetAdd.getHostAddress(); } catch(java.net.UnknownHostException uhe) { //handle exception } Connection conn = null; String usernameDB = "newuser"; String passwordDB = "newuser"; String url = "jdbc:mysql://" + ip + ":3306/" + jComboBox1.getSelectedItem();
[23 Jun 2010 9:01]
Sveta Smirnova
Thank you for the feedback. > How can I create a remote connection from the external command line? I use the MySQL > Workbench and talk to the IP using dyndns.org, but also takes a long time. You can use --host and --port options. But your test shows WB has same issues as Java application. In the code you provided is not clear if MySQL connection or java.net.InetAddress.getByName("xyz.dyndns.org"); takes time. Please modify code as follow: test.java: //necessary headers class test { public static void main(){ try { java.net.InetAddress inetAdd = java.net.InetAddress.getByName("xyz.dyndns.org"); ip = inetAdd.getHostAddress(); System.out.println(ip); } catch(java.net.UnknownHostException uhe) { //handle exception } } } Compile and run this test.class, wrtie ip somewhere Now take your program and replace expression String url = "jdbc:mysql://" + ip + ":3306/" + jComboBox1.getSelectedItem(); with ip, then try to connect. See if there is any difference. Alternatively you can use WB or MySQL command line client to test numerical IP.
[23 Jul 2010 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".