You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2011/11/24 09:49:57 UTC
svn commit: r1205753 - in /db/derby/code/trunk/java/engine/org/apache/derby:
iapi/jdbc/ impl/jdbc/ jdbc/
Author: kahatlen
Date: Thu Nov 24 08:49:52 2011
New Revision: 1205753
URL: http://svn.apache.org/viewvc?rev=1205753&view=rev
Log:
DERBY-4845: Improve the dependency tracking for our build targets
Don't use impl.jdbc.Util from the iapi.jdbc package.
Added:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/ExceptionFactory.java (with props)
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement40.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver20.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java Thu Nov 24 08:49:52 2011
@@ -29,8 +29,6 @@ import java.sql.NClob;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.impl.jdbc.Util;
public class BrokeredCallableStatement40 extends BrokeredCallableStatement30
implements EngineCallableStatement40 {
@@ -298,8 +296,7 @@ public class BrokeredCallableStatement40
try {
return interfaces.cast(this);
} catch (ClassCastException cce) {
- throw Util.generateCsSQLException(SQLState.UNABLE_TO_UNWRAP,
- interfaces);
+ throw unableToUnwrap(interfaces);
}
}
/**
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java Thu Nov 24 08:49:52 2011
@@ -30,8 +30,6 @@ import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.sql.SQLWarning;
-import org.apache.derby.impl.jdbc.Util;
-
import org.apache.derby.iapi.error.SQLWarningFactory;
import org.apache.derby.shared.common.reference.SQLState;
@@ -49,6 +47,9 @@ public abstract class BrokeredConnection
protected boolean isClosed;
private String connString;
+ /** Exception factory for the underlying connection. */
+ private final ExceptionFactory exceptionFactory;
+
/**
Maintain state as seen by this Connection handle, not the state
of the underlying Connection it is attached to.
@@ -64,8 +65,11 @@ public abstract class BrokeredConnection
/////////////////////////////////////////////////////////////////////////
public BrokeredConnection(BrokeredConnectionControl control)
+ throws SQLException
{
this.control = control;
+ this.exceptionFactory =
+ control.getRealConnection().getExceptionFactory();
}
public final void setAutoCommit(boolean autoCommit) throws SQLException
@@ -364,6 +368,15 @@ public abstract class BrokeredConnection
//
/////////////////////////////////////////////////////////////////////////
+ /**
+ * Generate an exception reporting that there is no current connection.
+ * @return a no-current-connection exception
+ */
+ final SQLException noCurrentConnection() {
+ return exceptionFactory.getSQLException(
+ SQLState.NO_CURRENT_CONNECTION, null, null, null);
+ }
+
/**
* A little indirection for getting the real connection.
*
@@ -371,7 +384,7 @@ public abstract class BrokeredConnection
*/
final EngineConnection getRealConnection() throws SQLException {
if (isClosed)
- throw Util.noCurrentConnection();
+ throw noCurrentConnection();
return control.getRealConnection();
}
@@ -496,18 +509,6 @@ public abstract class BrokeredConnection
{
getRealConnection().addWarning(w);
}
-
- /**
- * Checks if the connection is closed and throws an exception if
- * it is.
- *
- * @exception SQLException if the connection is closed
- */
- protected final void checkIfClosed() throws SQLException {
- if (isClosed()) {
- throw Util.noCurrentConnection();
- }
- }
/**
* Get the string representation for this connection. Return
@@ -650,6 +651,13 @@ public abstract class BrokeredConnection
throws SQLException {
getRealConnection().resetFromPool();
}
+
+ /**
+ * Return the exception factory for the underlying connection.
+ */
+ public final ExceptionFactory getExceptionFactory() {
+ return exceptionFactory;
+ }
////////////////////////////////////////////////////////////////////
//
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java Thu Nov 24 08:49:52 2011
@@ -26,7 +26,6 @@ import java.sql.PreparedStatement;
import java.sql.CallableStatement;
import java.sql.SQLException;
import java.sql.Savepoint;
-import org.apache.derby.iapi.reference.JDBC30Translation;
/**
Extends BrokeredConnection to provide the JDBC 3.0 connection methods.
@@ -35,6 +34,7 @@ public class BrokeredConnection30 extend
{
public BrokeredConnection30(BrokeredConnectionControl control)
+ throws SQLException
{
super(control);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java Thu Nov 24 08:49:52 2011
@@ -31,7 +31,6 @@ import java.sql.SQLXML;
import java.sql.Struct;
import java.util.Properties;
import java.util.concurrent.Executor;
-import org.apache.derby.impl.jdbc.Util;
import org.apache.derby.iapi.reference.SQLState;
@@ -39,7 +38,8 @@ public class BrokeredConnection40
extends BrokeredConnection30 implements EngineConnection40 {
/** Creates a new instance of BrokeredConnection40 */
- public BrokeredConnection40(BrokeredConnectionControl control) {
+ public BrokeredConnection40(BrokeredConnectionControl control)
+ throws SQLException {
super(control);
}
@@ -309,7 +309,7 @@ public class BrokeredConnection40
public final boolean isWrapperFor(Class<?> interfaces) throws SQLException {
try {
if (getRealConnection().isClosed())
- throw Util.noCurrentConnection();
+ throw noCurrentConnection();
return interfaces.isInstance(this);
} catch (SQLException sqle) {
notifyException(sqle);
@@ -329,14 +329,15 @@ public class BrokeredConnection40
throws SQLException{
try {
if (getRealConnection().isClosed())
- throw Util.noCurrentConnection();
+ throw noCurrentConnection();
//Derby does not implement non-standard methods on
//JDBC objects
try {
return interfaces.cast(this);
} catch (ClassCastException cce) {
- throw Util.generateCsSQLException(SQLState.UNABLE_TO_UNWRAP,
- interfaces);
+ throw getExceptionFactory().getSQLException(
+ SQLState.UNABLE_TO_UNWRAP, null, null,
+ new Object[]{ interfaces });
}
} catch (SQLException sqle) {
notifyException(sqle);
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java Thu Nov 24 08:49:52 2011
@@ -27,8 +27,6 @@ import java.sql.NClob;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;
-import org.apache.derby.impl.jdbc.Util;
-import org.apache.derby.iapi.reference.SQLState;
public class BrokeredPreparedStatement40 extends BrokeredPreparedStatement30{
@@ -97,8 +95,7 @@ public class BrokeredPreparedStatement40
try {
return interfaces.cast(this);
} catch (ClassCastException cce) {
- throw Util.generateCsSQLException(SQLState.UNABLE_TO_UNWRAP,
- interfaces);
+ throw unableToUnwrap(interfaces);
}
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java Thu Nov 24 08:49:52 2011
@@ -23,8 +23,6 @@ package org.apache.derby.iapi.jdbc;
import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.impl.jdbc.Util;
-
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -62,7 +60,6 @@ public class BrokeredStatement implement
// underlying statement is open.
resultSetType = getResultSetType();
resultSetConcurrency = getResultSetConcurrency();
-
resultSetHoldability = getResultSetHoldability();
}
@@ -558,8 +555,7 @@ public class BrokeredStatement implement
/**
* Checks if the statement is closed and throws an exception if it
- * is. This method relies on the <code>isClosed()</code> method
- * and therefore only works with JDBC 4.0.
+ * is.
*
* @exception SQLException if the statement is closed
*/
@@ -567,10 +563,24 @@ public class BrokeredStatement implement
throws SQLException
{
if (isClosed()) {
- throw Util.generateCsSQLException(SQLState.ALREADY_CLOSED,
- "Statement");
+ throw control.getExceptionFactory().getSQLException(
+ SQLState.ALREADY_CLOSED, null, null,
+ new Object[]{ "Statement" });
}
}
+
+ /**
+ * Return an exception that reports that an unwrap operation has failed
+ * because the object couldn't be cast to the specified interface.
+ *
+ * @param iface the class or interface passed in to the failed unwrap call
+ * @return an exception indicating that unwrap failed
+ */
+ final SQLException unableToUnwrap(Class iface) {
+ return control.getExceptionFactory().getSQLException(
+ SQLState.UNABLE_TO_UNWRAP, null, null,
+ new Object[]{ iface });
+ }
////////////////////////////////////////////////////////////////////
//
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement40.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement40.java Thu Nov 24 08:49:52 2011
@@ -21,9 +21,6 @@
package org.apache.derby.iapi.jdbc;
import java.sql.SQLException;
-import org.apache.derby.impl.jdbc.Util;
-import org.apache.derby.iapi.reference.SQLState;
-
public class BrokeredStatement40 extends BrokeredStatement {
@@ -56,8 +53,7 @@ public class BrokeredStatement40 extends
try {
return interfaces.cast(this);
} catch (ClassCastException cce) {
- throw Util.generateCsSQLException(SQLState.UNABLE_TO_UNWRAP,
- interfaces);
+ throw unableToUnwrap(interfaces);
}
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java Thu Nov 24 08:49:52 2011
@@ -80,4 +80,10 @@ public interface BrokeredStatementContro
@param s Statement that created the ResultSet.
*/
public ResultSet wrapResultSet(Statement s, ResultSet rs);
+
+ /**
+ * Return the exception factory for the underlying connection.
+ * @return an exception factory instance
+ */
+ public ExceptionFactory getExceptionFactory();
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java Thu Nov 24 08:49:52 2011
@@ -116,7 +116,15 @@ public interface EngineConnection extend
* schema are reset.
*/
public void resetFromPool() throws SQLException;
-
+
+ /**
+ * Return an exception factory that could be used to generate
+ * {@code SQLException}s raised by this connection.
+ *
+ * @return an exception factory instance
+ */
+ public ExceptionFactory getExceptionFactory();
+
////////////////////////////////////////////////////////////////////
//
// INTRODUCED BY JDBC 4.1 IN JAVA 7
Added: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/ExceptionFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/ExceptionFactory.java?rev=1205753&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/ExceptionFactory.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/ExceptionFactory.java Thu Nov 24 08:49:52 2011
@@ -0,0 +1,72 @@
+/*
+
+ Derby - Class org.apache.derby.iapi.jdbc.ExceptionFactory
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+
+package org.apache.derby.iapi.jdbc;
+
+import java.sql.SQLException;
+
+/**
+ * An exception factory is used to create SQLExceptions of the correct type.
+ */
+public interface ExceptionFactory {
+
+ /**
+ * Unpack a SQL exception, looking for an EmbedSQLException which carries
+ * the Derby messageID and args which we will serialize across DRDA so
+ * that the client can reconstitute a SQLException with appropriate text.
+ * If we are running JDBC 3, then we hope that the passed-in
+ * exception is already an EmbedSQLException, which carries all the
+ * information we need.
+ *
+ * @param se the exception to unpack
+ * @return the argument ferry for the exception
+ */
+ SQLException getArgumentFerry(SQLException se);
+
+ /**
+ * Construct an SQLException whose message and severity are specified
+ * explicitly.
+ *
+ * @param message the exception message
+ * @param messageId the message id
+ * @param next the next SQLException
+ * @param severity the severity of the exception
+ * @param cause the cause of the exception
+ * @param args the message arguments
+ * @return an SQLException
+ */
+ SQLException getSQLException(String message, String messageId,
+ SQLException next, int severity, Throwable cause, Object[] args);
+
+ /**
+ * Construct an SQLException whose message and severity are derived from
+ * the message id.
+ *
+ * @param messageId the message id
+ * @param next the next SQLException
+ * @param cause the cause of the exception
+ * @param args the message arguments
+ * @return an SQLException
+ */
+ SQLException getSQLException(String messageId, SQLException next,
+ Throwable cause, Object[] args);
+
+}
Propchange: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/ExceptionFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Thu Nov 24 08:49:52 2011
@@ -21,7 +21,6 @@
package org.apache.derby.impl.jdbc;
-import org.apache.derby.iapi.error.ExceptionSeverity;
import org.apache.derby.jdbc.InternalDriver;
import org.apache.derby.iapi.reference.Attribute;
@@ -54,8 +53,6 @@ import org.apache.derby.iapi.store.acces
import org.apache.derby.iapi.store.replication.master.MasterFactory;
import org.apache.derby.iapi.store.replication.slave.SlaveFactory;
-import org.apache.derby.iapi.util.IdUtil;
-
import java.io.IOException;
import java.security.Permission;
@@ -83,6 +80,7 @@ import java.util.Properties;
import java.util.Iterator;
import org.apache.derby.iapi.jdbc.EngineLOB;
+import org.apache.derby.iapi.jdbc.ExceptionFactory;
import org.apache.derby.iapi.util.InterruptStatus;
import org.apache.derby.impl.jdbc.authentication.NoneAuthenticationServiceImpl;
@@ -3078,6 +3076,11 @@ public abstract class EmbedConnection im
}
}
+ /** Get the exception factory for this connection. */
+ public ExceptionFactory getExceptionFactory() {
+ return Util.getExceptionFactory();
+ }
+
protected SQLException newSQLException(String messageId) {
return Util.generateCsSQLException(messageId);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory.java Thu Nov 24 08:49:52 2011
@@ -21,12 +21,9 @@
package org.apache.derby.impl.jdbc;
-import java.io.IOException;
-import org.apache.derby.iapi.error.ExceptionSeverity;
-import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.jdbc.ExceptionFactory;
import org.apache.derby.iapi.services.i18n.MessageService;
-import org.apache.derby.iapi.reference.MessageId;
import java.sql.SQLException;
@@ -34,7 +31,7 @@ import java.sql.SQLException;
*Class to create SQLException
*
*/
-public class SQLExceptionFactory {
+public class SQLExceptionFactory implements ExceptionFactory {
/**
* method to construct SQLException
* version specific drivers can overload this method to create
@@ -46,6 +43,17 @@ public class SQLExceptionFactory {
t, args);
}
+ /**
+ * Construct an SQLException whose message and severity are derived from
+ * the message id.
+ */
+ public final SQLException getSQLException(String messageId,
+ SQLException next, Throwable cause, Object[] args) {
+ String message = MessageService.getCompleteMessage(messageId, args);
+ int severity = StandardException.getSeverityFromIdentifier(messageId);
+ return getSQLException(message, messageId, next, severity, cause, args);
+ }
+
/**
* Unpack a SQL exception, looking for an EmbedSQLException which carries
* the Derby messageID and args which we will serialize across DRDA so
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver20.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver20.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver20.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver20.java Thu Nov 24 08:49:52 2011
@@ -24,11 +24,7 @@ package org.apache.derby.jdbc;
import org.apache.derby.iapi.reference.Attribute;
import org.apache.derby.iapi.reference.MessageId;
import org.apache.derby.iapi.reference.Property;
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.impl.jdbc.EmbedConnection;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.sql.ResultSet;
import org.apache.derby.iapi.jdbc.BrokeredConnection;
@@ -40,10 +36,8 @@ import org.apache.derby.iapi.security.Se
import org.apache.derby.impl.jdbc.*;
-import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Driver;
-import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.security.Permission;
@@ -94,7 +88,10 @@ public abstract class Driver20 extends I
return new EmbedResultSet20(conn, results, forMetaData, statement,
isAtomic);
}
- public abstract BrokeredConnection newBrokeredConnection(BrokeredConnectionControl control);
+
+ public abstract BrokeredConnection newBrokeredConnection(
+ BrokeredConnectionControl control) throws SQLException;
+
/**
* <p>The getPropertyInfo method is intended to allow a generic GUI tool to
* discover what properties it should prompt a human for in order to get
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java Thu Nov 24 08:49:52 2011
@@ -125,7 +125,10 @@ public class Driver30 extends Driver20 {
resultSetConcurrency,
resultSetHoldability);
}
- public BrokeredConnection newBrokeredConnection(BrokeredConnectionControl control) {
+ public BrokeredConnection newBrokeredConnection(
+ BrokeredConnectionControl control)
+ throws SQLException
+ {
return new BrokeredConnection30(control);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java Thu Nov 24 08:49:52 2011
@@ -129,8 +129,9 @@ public class Driver40 extends Driver30 {
resultSetConcurrency,
resultSetHoldability);
}
- public BrokeredConnection newBrokeredConnection(BrokeredConnectionControl control) {
-
+
+ public BrokeredConnection newBrokeredConnection(
+ BrokeredConnectionControl control) throws SQLException {
return new BrokeredConnection40(control);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java Thu Nov 24 08:49:52 2011
@@ -184,7 +184,7 @@ class EmbedPooledConnection implements j
realConnection.setApplicationConnection(currentConnectionHandle);
}
- final Connection getNewCurrentConnectionHandle() {
+ final Connection getNewCurrentConnectionHandle() throws SQLException {
Connection applicationConnection = currentConnectionHandle =
((org.apache.derby.jdbc.Driver20) (realConnection.getLocalDriver())).newBrokeredConnection(this);
realConnection.setApplicationConnection(applicationConnection);
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java?rev=1205753&r1=1205752&r2=1205753&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java Thu Nov 24 08:49:52 2011
@@ -26,7 +26,7 @@ import org.apache.derby.iapi.jdbc.Broker
import org.apache.derby.iapi.jdbc.BrokeredStatement;
import org.apache.derby.iapi.jdbc.BrokeredPreparedStatement;
import org.apache.derby.iapi.jdbc.BrokeredCallableStatement;
-import org.apache.derby.iapi.jdbc.EngineStatement;
+import org.apache.derby.iapi.jdbc.ExceptionFactory;
import org.apache.derby.impl.jdbc.EmbedConnection;
import org.apache.derby.impl.jdbc.EmbedResultSet;
import org.apache.derby.impl.jdbc.EmbedStatement;
@@ -241,4 +241,11 @@ final class XAStatementControl implement
public int checkHoldCursors(int holdability) throws SQLException {
return xaConnection.checkHoldCursors(holdability, true);
}
+
+ /**
+ * Return the exception factory for the underlying connection.
+ */
+ public ExceptionFactory getExceptionFactory() {
+ return applicationConnection.getExceptionFactory();
+ }
}