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 dj...@apache.org on 2006/02/21 21:06:17 UTC
svn commit: r379567 - in
/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda: Database.java
XADatabase.java
Author: djd
Date: Tue Feb 21 12:06:08 2006
New Revision: 379567
URL: http://svn.apache.org/viewcvs?rev=379567&view=rev
Log:
DERBY-1015 (partial) Modify the network server to hold the embedded Connection
object as a EngineConnection reference instead of a vanilla Connection. Does
not change the uses of the connection reference to take advantage of the consistent
api, will be done in a future patch.
Modified:
db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java
db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/XADatabase.java
Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java?rev=379567&r1=379566&r2=379567&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java Tue Feb 21 12:06:08 2006
@@ -29,6 +29,8 @@
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.Properties;
+
+import org.apache.derby.iapi.jdbc.EngineConnection;
import org.apache.derby.iapi.reference.Attribute;
import org.apache.derby.iapi.tools.i18n.LocalizedResource;
import org.apache.derby.impl.jdbc.EmbedConnection;
@@ -67,7 +69,10 @@
// occurred in this transaction
protected boolean sendTRGDFTRT = false; // Send package target default value
- private Connection conn; // Connection to the database
+ /**
+ * Connection to the database in the embedded engine.
+ */
+ private EngineConnection conn;
DRDAStatement defaultStatement; // default statement used
// for execute imm
private DRDAStatement currentStatement; // current statement we are working on
@@ -112,7 +117,7 @@
* @param conn Connection
* @exception SQLException
*/
- void setConnection(Connection conn)
+ final void setConnection(EngineConnection conn)
throws SQLException
{
this.conn = conn;
@@ -124,7 +129,7 @@
*
* @return connection
*/
- Connection getConnection()
+ final EngineConnection getConnection()
{
return conn;
}
@@ -206,7 +211,6 @@
* Make a new connection using the database name and set
* the connection in the database
* @param p Properties for connection attributes to pass to connect
- * @return new local connection
*/
void makeConnection(Properties p) throws SQLException
{
@@ -215,7 +219,11 @@
// take care of case of SECMEC_USRIDONL
if(password != null)
p.put(Attribute.PASSWORD_ATTR, password);
- Connection conn = NetworkServerControlImpl.getDriver().connect(Attribute.PROTOCOL
+
+ // Contract between network server and embedded engine
+ // is that any connection returned implements EngineConnection.
+ EngineConnection conn = (EngineConnection)
+ NetworkServerControlImpl.getDriver().connect(Attribute.PROTOCOL
+ shortDbName + attrString, p);
if(conn != null){
conn.setAutoCommit(false);
Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/XADatabase.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/XADatabase.java?rev=379567&r1=379566&r2=379567&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/XADatabase.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/XADatabase.java Tue Feb 21 12:06:08 2006
@@ -41,6 +41,7 @@
import org.apache.derby.jdbc.EmbeddedXADataSource;
import org.apache.derby.impl.drda.DRDAXid;
import org.apache.derby.iapi.jdbc.BrokeredConnection;
+import org.apache.derby.iapi.jdbc.EngineConnection;
class XADatabase extends Database {
@@ -75,7 +76,7 @@
if (attrString != null)
xaDataSource.setConnectionAttributes(attrString);
- Connection conn = getConnection();
+ EngineConnection conn = getConnection();
// If we have no existing connection. this is a brand new XAConnection.
if (conn == null)
{
@@ -88,7 +89,9 @@
}
// Get a new logical connection.
- conn = xaConnection.getConnection();
+ // Contract between network server and embedded engine
+ // is that any connection returned implements EngineConnection.
+ conn = (EngineConnection) xaConnection.getConnection();
// Client will always drive the commits so connection should
// always be autocommit false on the server. DERBY-898/DERBY-899
conn.setAutoCommit(false);