Bug #4334 autoReconnect, host ports
Submitted: 29 Jun 2004 19:43 Modified: 3 Aug 2004 17:50
Reporter: Mark Matthews Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.0.14 OS:NA
Assigned to: Mark Matthews CPU Architecture:Any

[29 Jun 2004 19:43] Mark Matthews
Description:
Whem I'm using failover hosts I have problems, when using
AutoReconnect=true - for example if a host1 fail during established
connection, I get exeption - driver don't figure itself that host1 is
down and stop working (don't connect to host2). Even if I do a new
connection and  host1 is still down, driver won't go to host2.
Without using autoReconnect it's working - It does not reconnect to host2
during session, but when you make new connection - it figures out that
host1 is down and connects to host2.

Second issue - if you are using jdbc with one host and you specify another
port - it's working. But if you specify two hosts like host1,host2:<port>
it ignores port number and is trying to connect to default mysql port - 3306.

Thanks, bye, gorazd

How to repeat:
Connection conn = DriverManager.getConnection("jdbc:mysql://foo:3307,foo:3308/test?user=xxx&password=xxx&autoReconnect=true");
		
		Statement stmt = conn.createStatement();
		
		ResultSet rs = stmt.executeQuery("SHOW VARIABLES LIKE 'version'");
		rs.next();
		
		System.out.println(rs.getString(2));
		
		System.out.println("Kill server/thread and press return....");
		
		System.in.read();
		
		try {
			rs = stmt.executeQuery("SHOW VARIABLES LIKE 'version'");
		} catch (SQLException sqlEx) {
			sqlEx.printStackTrace();
		}
		
		rs = stmt.executeQuery("SHOW VARIABLES LIKE 'version'");
		rs.next();
			
		System.out.println(rs.getString(2));
[3 Aug 2004 17:50] Mark Matthews
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html