[ 
http://issues.apache.org/jira/browse/DERBY-243?page=comments#action_65821 ]
     
David Van Couvering commented on DERBY-243:
-------------------------------------------

In response to Kathey's request, I am providing information on the semantics 
for providing a unique string representation for a connection.  

First, it is important to identify three major types of connections in Derby:

POOLED CONNECTIONS
Pooled Connections are a subtype of javax.sql.PooledConnection.  They represent 
a connection stored on a pool.  References to PooledConnections are never 
directly visible to application code.  They are used by implementors of 
connection pools so that management of pooled connections can be standardized 
across JDBC driver providers.

PROXY CONNECTIONS
Proxy connections are a class of connections that, although they implement the 
java.sql.Connection interface, don't directly implement the methods of 
java.sql.Connection.  Instead, they act as a proxy to an underlying physical 
connection, and allow containers to "inject" container logic when key 
connectoin lifecycle events occur.  These are also sometimes called "logical 
connections" or "brokered connections".

PHYSICAL CONNECTIONS

These are the connection classes that do the "heavy lifting" of actually 
implementing the methods on java.sql.Connection.  They are the underlying 
physical connections wrapped by proxy connections.  

CONNECTION STRING SEMANTICS
With these definitions in place, here are the semantics of connection strings:

- When a physical connection is created, it is assigned a unique UUID that is 
unchanged for the lifetime of the connection.

- When an application calls Connection.toString(), it gets the string 
"Connection_<UUID>" of the underlying physical connection, regardless of where 
the application has a reference to the physical connection itself a reference 
to a proxy connection (aka brokered connection) that wraps the physical 
connection.

- A pooled connection is assigned a separate UUID from a physical connection.  
When a container calls PooledConnection.toString(), it gets the string 
"PooledConnection_<UUID>".  This is useful for developers implementing 
connection pools when they are trying to debug pooled connections



> connection toString should uniquely identify the connection
> -----------------------------------------------------------
>
>          Key: DERBY-243
>          URL: http://issues.apache.org/jira/browse/DERBY-243
>      Project: Derby
>         Type: Improvement
>   Components: JDBC
>     Reporter: Kathey Marsden
>     Assignee: David Van Couvering
>     Priority: Trivial
>      Fix For: 10.0.2.0, 10.0.2.1, 10.0.2.2, 10.1.0.0
>  Attachments: DERBY-243.diff
>
> The toString() on the Derby connection doesn't print 
> unique information.
> for example  System.out.println(conn) prints:
> EmbedConnection  in the case of derby embedded
> It would be great if the toString() method for connections could be used to 
> differentiate one connection from another.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to