[CONJ-67] MySQLConnection class does not implement all JDBC4 methods and silently discards/ignores calls to them Created: 2013-10-08  Updated: 2015-01-29  Resolved: 2013-11-15

Status: Closed
Project: MariaDB Connector/J
Component/s: None
Affects Version/s: 1.1.5
Fix Version/s: 1.1.6

Type: Bug Priority: Critical
Reporter: Torsten Krah Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

JDK 1.7


Issue Links:
Relates
relates to CONJ-75 Implement useful jdbc4 abort(Executor... Closed

 Description   

Hi,

jdbc4 got the new "abort" method on a connection (the mysql jdbc driver from oracle does implement this) and i am using this in case i need to forcefully close the connection.

Tried this with MariaDB driver and all seems fine - no exception, but the connection did leak - so i wonder.
Looking at the source is see this:

	public void abort(Executor arg0) throws SQLException {
		// TODO Auto-generated method stub
		
	}
 
	public int getNetworkTimeout() throws SQLException {
		// TODO Auto-generated method stub
		return 0;
	}
 
	public String getSchema() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}
 
	public void setNetworkTimeout(Executor arg0, int arg1) throws SQLException {
		// TODO Auto-generated method stub
		
	}
 
	public void setSchema(String arg0) throws SQLException {
		// TODO Auto-generated method stub
		
	}

Please - just throw an UnsupportedOperationException or a SQLException telling the user that you did not implemented this yet, but silently discard this call, leaving the caller with the wrong assumption that the operation did succeed, is imho not the way it should be.



 Comments   
Comment by Georg Richter [ 2013-11-15 ]

Fixed in rev. 495

Comment by Torsten Krah [ 2015-01-29 ]

Hi,

this one suffers the same problem like CONJ-75:

SecurityManager securityManager = new SecurityManager();

This won't be null if there is not already one installed which denies the creation of a new one.
Please use

System.getSecurityManager() != null

and check for null, otherwise stuff won't run without any SM installed, which is imho the most usecase.

Generated at Thu Feb 08 03:12:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.