You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Saleem EDAH-TALLY <nm...@netcourrier.com> on 2010/07/18 18:15:08 UTC
Database-side programming
Hello,
This concerns getting information from 'inside' Derby through JAVA code called
by a procedure.
The nested connection can be obtained with jdbc:default:connection. However
the URL attributes cannot be retrieved in any way.
conn.getClientInfo() returns an empty Properties object.
conn.getMetaData().getUserName() returns nothing.
The Derby Developper's Guide states the following :
*********************************************************************************
Connection conn = DriverManager.getConnection(
"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 don't want to specify URL attributes. I wish to know how can one retrieve
information about these current URL attributes, namely, SSL mode.
Also, how can one determine in database-side programming if it's the client
driver or the embedded driver that's in use ? i.e, without parsing the URL
(presence of // would mean client driver in use, else it's embedded driver).
Thank you.
Re: Database-side programming
Posted by SET <nm...@netcourrier.com>.
It would be helpful to know if a database is
accessed in client or embedded mode.
Suppose you distribute a database containing a JAR file added through
sqlj.install_jar.
The client can access it using the client driver or the embedded
driver.
The stored procedures won't be aware of the access mode.
These stored
procedures inside may need to connect to another
database known to be present in a known location.
Or may need to create another database.
Knowledge of which driver is in use would help.
in constructing the full URL to access the external database.
Re: Database-side programming
Posted by SET <nm...@netcourrier.com>.
Kristian Waagan <kr...@...> writes:
>
> On 18.07.10 18:15, Saleem EDAH-TALLY wrote:
> > Hello,
> >
> > This concerns getting information from 'inside' Derby through JAVA code
called
> > by a procedure.
> >
> > The nested connection can be obtained with jdbc:default:connection. However
> > the URL attributes cannot be retrieved in any way.
>
> Hi,
>
> Maybe it would help if you tell why you want to do this, so people can
> suggest a different mechanism if appropriate?
...
...
>From a stored procedure, I have to open a connection to another database.
The main unknown is the ssl mode parameter with the client driver. This parameter
is meaningless in embedded mode.
I could not find a way to determine this parameter from a stored procedure.
There is the derby.drda.sslMode property which can be retrieved from a
NetworkServerControl instance, but I could not find a way to access the current
instance.
CURRENT_USER does give the desired parameter.
Thank you for your reply.
Re: Database-side programming
Posted by Kristian Waagan <kr...@oracle.com>.
On 18.07.10 18:15, Saleem EDAH-TALLY wrote:
> Hello,
>
> This concerns getting information from 'inside' Derby through JAVA code called
> by a procedure.
>
> The nested connection can be obtained with jdbc:default:connection. However
> the URL attributes cannot be retrieved in any way.
Hi,
Maybe it would help if you tell why you want to do this, so people can
suggest a different mechanism if appropriate?
>
>
> conn.getClientInfo() returns an empty Properties object.
>
Adding support for getClientInfo is briefly discussed in DERBY-3849 [1].
Would it be helpful in your use case?
> conn.getMetaData().getUserName() returns nothing.
>
Can you obtain the current user name with CURRENT_USER?
> The Derby Developper's Guide states the following :
>
> *********************************************************************************
> Connection conn = DriverManager.getConnection(
> "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 don't want to specify URL attributes. I wish to know how can one retrieve
> information about these current URL attributes, namely, SSL mode.
>
I'm not aware of a way to determine if the connection to the database is
encrypted from within a stored procedure.
Doing so seems a bit "out of spec", which is why I asked what you want
to achieve :)
Regards,
--
Kristian
[1] https://issues.apache.org/jira/browse/DERBY-3849
> Also, how can one determine in database-side programming if it's the client
> driver or the embedded driver that's in use ? i.e, without parsing the URL
> (presence of // would mean client driver in use, else it's embedded driver).
>
> Thank you.
>
>
>