Bug #44354 DriverManager.getConnection() needs several minutes to connect
| Submitted: | 18 Apr 2009 16:11 | Modified: | 7 May 2009 11:13 |
|---|---|---|---|
| Reporter: | f6bfc445c2d2@754b4224a789.anonbo f6bfc445c2d2@754b4224a789.anonbo | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | Connector / J | Severity: | S3 (Non-critical) |
| Version: | 5.1.6+dfsg-1 | OS: | Linux (Debian 5.0 x86_64) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | MySQL Connector Java libmysql-java | ||
[19 Apr 2009 0:11]
Mark Matthews
Is "localhost" defined in your /etc/hosts? If so, what IP addresses does it map to? This smells like broken DNS of some sort.
[22 Apr 2009 9:51]
f6bfc445c2d2@754b4224a789.anonbo f6bfc445c2d2@754b4224a789.anonbo
Yes, localhost points to 127.0.0.1. Even if I use the ip and port number in getConnection() nothing changes. In my.cnf: bind-connection=127.0.0.1, port=3306. Switching to the latest Connector (5.1.7) didn't help too.
From mysql.log:
090422 07:37:47 37 Connect username@localhost on test
37 Query /* mysql-connector-java-5.1.7 ( Revision: ${svn.Revision} ) */SHOW VARIABLES WHERE Variable_name ='language' OR Variable_name = 'net_write_timeout' OR Variable_name = 'interactive_timeout' OR Variable_name = 'wait_timeout' OR Variable_name = 'character_set_client' OR Variable_name = 'character_set_connection' OR Variable_name = 'character_set' OR Variable_name = 'character_set_server' OR Variable_name = 'tx_isolation' OR Variable_name = 'transaction_isolation' OR Variable_name = 'character_set_results' OR Variable_name = 'timezone' OR Variable_name = 'time_zone' OR Variable_name = 'system_time_zone' OR Variable_name = 'lower_case_table_names' OR Variable_name = 'max_allowed_packet' OR Variable_name = 'net_buffer_length' OR Variable_name = 'sql_mode' OR Variable_name = 'query_cache_type' OR Variable_name = 'query_cache_size' OR Variable_name = 'init_connect'
37 Query /* mysql-connector-java-5.1.7 ( Revision: ${svn.Revision} ) */SELECT @@session.auto_increment_increment
37 Query SHOW COLLATION
37 Query SET NAMES latin1
37 Query SET character_set_results = NULL
37 Query SET autocommit=1
37 Query SET sql_mode='STRICT_TRANS_TABLES'
37 Query select * from tel
[7 May 2009 11:13]
Tonci Grgin
Sorry but I really don't know what to do with this report... I have never seen such delays on any of the systems I used (none Debian though). It would be wise from you to start debugging your environment for cause as I'm closing the report on the grounds that it's not repeatable.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Hello. The democode: import java.sql.*; public class main_jdbc { public static void main(String[] args) throws Exception { try { Class.forName( "com.mysql.jdbc.Driver" ).newInstance(); Connection c = DriverManager.getConnection("jdbc:mysql://localhost/test", "username", "password"); System.out.println("DEBUG: DB Connection established"); Statement s = c.createStatement(); ResultSet r = s.executeQuery("select * from tel;"); System.out.println("DEBUG: DB Query successfull"); while(r.next()) { System.out.println(r.getString("name")+" "+r.getString("number")); } } catch(Exception e) { e.printStackTrace(); } } } Establishing the connection needs several minutes, afterwards everything runs fine (Query is executed, results are printed, no time lag). System details: OS: Standard Debian 5.0 x86_64 fully patched Eclipse: 3.2.2-6.1 JRE: sun-java6-jre 6-12-1 (same behaviour with openjdk-6-jre) MySQL Server: 5.0.51a-24 from Debian Repositories libmysql-java: 5.1.6+dfsg-1 from Debian Repositories How to repeat: unknown Suggested fix: unknown