Package oracle.jdbc.babelfish
Class BabelfishConnection
- java.lang.Object
-
- oracle.jdbc.babelfish.BabelfishGenericProxy
-
- oracle.jdbc.babelfish.BabelfishConnection
-
- All Implemented Interfaces:
OracleTranslatingConnection
public abstract class BabelfishConnection extends BabelfishGenericProxy implements OracleTranslatingConnection
Proxy Superclass for java.sql.Connection interface. It is used by the Oracle JDBC proxy library to proxify java.sql.Connection objects to support the auto translation features.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface oracle.jdbc.OracleTranslatingConnection
OracleTranslatingConnection.SqlTranslationVersion
-
-
Constructor Summary
Constructors Constructor Description BabelfishConnection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Releases thisConnectionobject's database and JDBC resources immediately instead of waiting for them to be automatically released.java.sql.StatementcreateStatement()Creates aStatementwith translation features enabledjava.sql.StatementcreateStatement(boolean translation)Similar to createStatement() but with an additional translation flag.java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency)Returns aStatementwith translation features enabledjava.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency, boolean translation)Similar to createStatement(int resultSetType, int resultSetConcurrency) but with an additional translation flag.java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)Returns aStatementwith translation features enabledjava.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean translation)Similar to createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) but with an additional translation flag.protected abstract java.lang.ObjectgetCreator()protected abstract java.lang.ObjectgetDelegate()java.util.Map<OracleTranslatingConnection.SqlTranslationVersion,java.lang.String>getSqlTranslationVersions(java.lang.String sql, boolean suppressExceptions)Returns a map of all the translation versions of the query during SQL Translation.java.lang.StringnativeSQL(java.lang.String sql)Converts the given foreign dialect SQL statement into the system's native SQL grammar.protected java.lang.Objectpost_Methods(java.lang.reflect.Method m, java.lang.Object result)Post interceptor.java.sql.CallableStatementprepareCall(java.lang.String sql)Translation enabled implementation of java.sql.Connection#prepareCall(java.lang.String)java.sql.CallableStatementprepareCall(java.lang.String sql, boolean translation)Similar to prepareCall(String sql) but with an additional translation flag.java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)Translation enabled implementation of java.sql.Connection#prepareCall(java.lang.String, int, int)java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, boolean translation)Similar to prepareCall(String sql, int resultSetType, int resultSetConcurrency) but with an additional translation flag.java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)Translation enabled implementation of java.sql.Connection#prepareCall(java.lang.String, int, int, int)java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean translation)Similar to prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) but with an additional translation flag.java.sql.PreparedStatementprepareStatement(java.lang.String sql)Translation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String)java.sql.PreparedStatementprepareStatement(java.lang.String sql, boolean translation)Similar to prepareStatement(String sql) but with an additional translation flag.java.sql.PreparedStatementprepareStatement(java.lang.String sql, int autoGeneratedKeys)Translation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, int)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int[] columnIndexes)Translation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, int[])java.sql.PreparedStatementprepareStatement(java.lang.String sql, int[] columnIndexes, boolean translation)Similar to prepareStatement(String sql, int[] columnIndexes) but with an additional translation flag.java.sql.PreparedStatementprepareStatement(java.lang.String sql, int autoGeneratedKeys, boolean translation)Similar to prepareStatement(String sql, int autoGeneratedKeys) but with an additional translation flag.java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)Translation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, int, int)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, boolean translation)Similar to prepareStatement(String sql, int resultSetType, int resultSetConcurrency) but with an additional translation flag.java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)Translation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, int, int, int)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean translation)Similar to prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) but with an additional translation flag.java.sql.PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] columnNames)Translation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[])java.sql.PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] columnNames, boolean translation)Similar to prepareStatement(String sql, String[] columnNames) but with an additional translation flag.protected abstract java.lang.Objectproxify(java.lang.Object d, java.lang.Object creator)protected java.lang.ObjecttranslateError(java.lang.reflect.Method m, java.sql.SQLException ex)Interceptor for translation of errors.
-
-
-
Method Detail
-
getCreator
protected abstract java.lang.Object getCreator()
- Specified by:
getCreatorin classBabelfishGenericProxy- Returns:
-
getDelegate
protected abstract java.lang.Object getDelegate()
- Specified by:
getDelegatein classBabelfishGenericProxy- Returns:
-
proxify
protected abstract java.lang.Object proxify(java.lang.Object d, java.lang.Object creator)
-
translateError
protected java.lang.Object translateError(java.lang.reflect.Method m, java.sql.SQLException ex) throws java.sql.SQLExceptionInterceptor for translation of errors.- Overrides:
translateErrorin classBabelfishGenericProxy- Returns:
- Throws:
java.sql.SQLException
-
post_Methods
protected java.lang.Object post_Methods(java.lang.reflect.Method m, java.lang.Object result)Post interceptor. sets up the translator in relevant objects required for handling error translation in those objects.- Overrides:
post_Methodsin classBabelfishGenericProxy- Returns:
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLExceptionTranslation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String)- Parameters:
sql-- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String)
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLExceptionTranslation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, int)- Parameters:
sql-- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, int)
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLExceptionTranslation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, int[])- Parameters:
sql-- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, int[])
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLExceptionTranslation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[])- Parameters:
sql-- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, java.lang.String[])
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLExceptionTranslation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, int, int)- Parameters:
sql-- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, int, int)
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLExceptionTranslation enabled implementation of java.sql.Connection#prepareStatement(java.lang.String, int, int, int)- Parameters:
sql-- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, int, int, int)
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLExceptionTranslation enabled implementation of java.sql.Connection#prepareCall(java.lang.String)- Parameters:
sql-- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.prepareCall(java.lang.String)
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLExceptionTranslation enabled implementation of java.sql.Connection#prepareCall(java.lang.String, int, int)- Parameters:
sql-- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.prepareCall(java.lang.String, int, int)
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLExceptionTranslation enabled implementation of java.sql.Connection#prepareCall(java.lang.String, int, int, int)- Parameters:
sql-- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.prepareCall(java.lang.String, int, int, int)
-
nativeSQL
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLExceptionConverts the given foreign dialect SQL statement into the system's native SQL grammar. A driver may convert the JDBC SQL grammar into its system's native SQL grammar prior to sending it. This method returns the native form of the statement that the driver would have sent.- Parameters:
sql- a foreign dialect SQL statement that may contain one or more '?' parameter placeholders- Returns:
- the native form of this statement
- Throws:
java.sql.SQLException- if a database access error occurs or this method is called on a closed connection
-
close
public void close() throws java.sql.SQLExceptionReleases thisConnectionobject's database and JDBC resources immediately instead of waiting for them to be automatically released.Calling the method
closeon aConnectionobject that is already closed is a no-op.It is strongly recommended that an application explicitly commits or rolls back an active transaction prior to calling the
closemethod. If theclosemethod is called and there is an active transaction, the results are implementation-defined.- Throws:
java.sql.SQLException- SQLException if a database access error occurs
-
createStatement
public java.sql.Statement createStatement() throws java.sql.SQLExceptionCreates aStatementwith translation features enabled- Throws:
java.sql.SQLException- See Also:
Connection.createStatement()
-
createStatement
public java.sql.Statement createStatement(boolean translation) throws java.sql.SQLExceptionSimilar to createStatement() but with an additional translation flag. If the translation flag is true then the returningStatementwill have translation enabled. If the flag is false then the returningStatementwill be a normalStatementwith no translation features.- Specified by:
createStatementin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLExceptionReturns aStatementwith translation features enabled- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.createStatement(int, int)
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, boolean translation) throws java.sql.SQLExceptionSimilar to createStatement(int resultSetType, int resultSetConcurrency) but with an additional translation flag. If the translation flag is true then the returningStatementwill have translation enabled. If the flag is false then the returningStatementwill be a normalStatementwith no translation features.- Specified by:
createStatementin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLExceptionReturns aStatementwith translation features enabled- Returns:
- Throws:
java.sql.SQLException- See Also:
Connection.createStatement(int, int, int)
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean translation) throws java.sql.SQLExceptionSimilar to createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) but with an additional translation flag. If the translation flag is true then the returningStatementwill have translation enabled. If the flag is false then the returningStatementwill be a normalStatementwith no translation features.- Specified by:
createStatementin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, boolean translation) throws java.sql.SQLExceptionSimilar to prepareStatement(String sql) but with an additional translation flag. If the translation flag is true then the returningPreparedStatementwill have translation enabled. If the flag is false then the returningPreparedStatementwill be a normalPreparedStatementwith no translation features.- Specified by:
prepareStatementin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys, boolean translation) throws java.sql.SQLExceptionSimilar to prepareStatement(String sql, int autoGeneratedKeys) but with an additional translation flag. If the translation flag is true then the returningPreparedStatementwill have translation enabled. If the flag is false then the returningPreparedStatementwill be a normalPreparedStatementwith no translation features.- Specified by:
prepareStatementin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes, boolean translation) throws java.sql.SQLExceptionSimilar to prepareStatement(String sql, int[] columnIndexes) but with an additional translation flag. If the translation flag is true then the returningPreparedStatementwill have translation enabled. If the flag is false then the returningPreparedStatementwill be a normalPreparedStatementwith no translation features.- Specified by:
prepareStatementin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames, boolean translation) throws java.sql.SQLExceptionSimilar to prepareStatement(String sql, String[] columnNames) but with an additional translation flag. If the translation flag is true then the returningPreparedStatementwill have translation enabled. If the flag is false then the returningPreparedStatementwill be a normalPreparedStatementwith no translation features.- Specified by:
prepareStatementin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, boolean translation) throws java.sql.SQLExceptionSimilar to prepareStatement(String sql, int resultSetType, int resultSetConcurrency) but with an additional translation flag. If the translation flag is true then the returningPreparedStatementwill have translation enabled. If the flag is false then the returningPreparedStatementwill be a normalPreparedStatementwith no translation features.- Specified by:
prepareStatementin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean translation) throws java.sql.SQLExceptionSimilar to prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) but with an additional translation flag. If the translation flag is true then the returningPreparedStatementwill have translation enabled. If the flag is false then the returningPreparedStatementwill be a normalPreparedStatementwith no translation features.- Specified by:
prepareStatementin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, boolean translation) throws java.sql.SQLExceptionSimilar to prepareCall(String sql) but with an additional translation flag. If the translation flag is true then the returningCallableStatementwill have translation enabled. If the flag is false then the returningCallableStatementwill be a normalCallableStatementwith no translation features.- Specified by:
prepareCallin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, boolean translation) throws java.sql.SQLExceptionSimilar to prepareCall(String sql, int resultSetType, int resultSetConcurrency) but with an additional translation flag. If the translation flag is true then the returningCallableStatementwill have translation enabled. If the flag is false then the returningCallableStatementwill be a normalCallableStatementwith no translation features.- Specified by:
prepareCallin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean translation) throws java.sql.SQLExceptionSimilar to prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) but with an additional translation flag. If the translation flag is true then the returningCallableStatementwill have translation enabled. If the flag is false then the returningCallableStatementwill be a normalCallableStatementwith no translation features.- Specified by:
prepareCallin interfaceOracleTranslatingConnection- Parameters:
translation- boolean flag to enable or disable translation- Throws:
java.sql.SQLException
-
getSqlTranslationVersions
public java.util.Map<OracleTranslatingConnection.SqlTranslationVersion,java.lang.String> getSqlTranslationVersions(java.lang.String sql, boolean suppressExceptions) throws java.sql.SQLException
Returns a map of all the translation versions of the query during SQL Translation. See the documentation of OracleTranslatingConnection.SqlTranslationVersion enum for more details about returning versions.- Specified by:
getSqlTranslationVersionsin interfaceOracleTranslatingConnection- Parameters:
sql- vendor specific sql to be translatedsuppressExceptions- suppresses any exception raised during query translation and returns whatever is available. Useful to get JDBC_MARKER_CONVERTED version when the translation is throwing error.- Returns:
- Map with all the translation versions of a query. In case of an Exception and suppressExceptions is true then the TRANSLATED version is null.
- Throws:
java.sql.SQLException- If there is a problem in query translation provided suppressExceptions is false.- See Also:
OracleTranslatingConnection
-
-