Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dtp-connect-dev] Reduce the Derby connection reference


Hey Rob,
        Thanks for your reply! I still think supporting both embeded derby and network derby is necessary for DTP. The following is an exerpt from the Derby developer's guide:
Getting a nested connection
When you are executing a method within SQL, that method might need to reuse the
current connection to the database in order to execute more SQL statements. Such a
connection is called a nested connection. The way for a method to get a nested
connection is to issue a connection request using the connection URL.
jdbc:default:connection
URL attributes are not supported as part of this connection URL. Any URL attributes
specified in a Properties object, user name, or password that are passed to a
java.sql.DriverManager.getConnection() call will be ignored.

I haven't investigated into this problem thoroughly, but I feel this might be an alternative way to tackle the "single connection per vm" problem. If we go this way, then I can just compare the newly created connection with the shared connection to see whether they are the same and whether I should close it. What do you think?

Best Regards!

Max ( Hui ) Cao
DTP SQL Dev Tools Committer
Sr S/W Eng - Dev
Sybase, Inc. Shanghai, China



rcernich@xxxxxxxxxx
Sent by: dtp-connect-dev-bounces@xxxxxxxxxxx

02/24/2006 11:15 AM

Please respond to
DTP Connectivity project development list <dtp-connect-dev@xxxxxxxxxxx>

To
DTP Connectivity project development list <dtp-connect-dev@xxxxxxxxxxx>
cc
Subject
Re: [dtp-connect-dev] Reduce the Derby connection reference






Hey Max,

Managed connections must be closed by calling
IConnectionProfile.disconnect().  The life cycle of the managed connection
is managed through IConnectionProfile.connect() and
IConnectionProfile.disconnect().

The embedded Derby connection is a special beast.  There can only ever be a
single connection within a VM, which is why this reference counting method
is employed by the connection factory.  That said, the java.sql.Connection
returned by the IConnection object will be the same for all invocations on
the connection factory for a given embedded Derby connection profile.

If you are getting errors in the DSE because the connection can't be
created, my guess is that a connection to that DB is being created outside
the context of the connection profile's connection factory.  Note, this is
a limitation of the embedded Derby connection profile.

If this is important to you, I would suggest using Derby in a networked
mode.  Derby behaves more like a "normal" DB when running as a networked
DB.  See the following mailing list entry along with the Derby
documentation for instructions on setting this up
(http://dev.eclipse.org/mhonarc/lists/dtp-dev/msg00164.html).  (Note, there
are two different driver definitions for Derby; one for embedded Derby
which is used by the embedded Derby connection profile, and one for
networked Derby which should be used with the generic DB connection
profile.

Please let me know if you need anything else.
Rob

_______________________________________________
dtp-connect-dev mailing list
dtp-connect-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dtp-connect-dev



Back to the top