db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: CREATE FUNCTION with SQL examples ?
Date Sat, 18 Dec 2004 15:59:53 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Suavi Ali Demir wrote:


> In the context of a stored procedure that is executing
> though a sql statement that was executed using an
> existing connection why would any database not be able
> to return a reference to the current connection?

>>default connection: a JDBC connection to the current
>>SQL-implementation,
>>SQL-session, and SQLtransaction
>>established with the data source URL
>>'jdbc:default:connection'.

So yes any database has to return a Connection object that represents
the current connection (lower case c) or session, but that cannot be a
reference to the application's JDBC Connection object in a client/server
world.

> When we call our stored proc, it is running inside the
> engine already, it is not a different machine or
> anything. It is the connection that is executing the
> sql statement that invoked our stored proc. It should
> be possible to pass a reference to the current
> connection in such cases, no?

Well in would be possible, but then Derby wouldn't match the SQL
specification. The Connection object returned by jdbc:default:connection
needs to be a different object for at least these two reasons:

 1) Default Connection is in auto-commit mode 'false', regardless of the
application's Connection state.

 2) Default Connection can be closed, can't have a close in a procedure
or function closing the application's Connection.

And no, you cannot just use the same Connection object and reset state
after the procedure or function has completed as the application may be
using its Connection object in a different thread while the procedure or
function is running.

Dan.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBxFP5Iv0S4qsbfuQRApIgAJ9xIOoEkDbpSv3ShmqClQQjrJXyFACeIqNm
G1VV4DJi4rJEQVIhglXQaj0=
=Cmy7
-----END PGP SIGNATURE-----


Mime
View raw message