runtime access to database connection properties

Hi all :)

How can I, at runtime, get access to the properties of the database connection(s) which sit behind my solution ?

Ideally, I want to get the full set of parameters which define the connections that Servoy instantiates.

These attributes are:
_username,
_password,
_host,
_port,
_database,
_subProtocol,
_subName,
_driverName

I need these parameters in order to create new Connection’s ‘independently of Servoy’ for use within a Servoy plugin.

Any assistance greatly appreciated.

ps:I don’t think accessing properties files is the way to do this given that client applications may not have access to such resources…just thinking aloud here :)

julian

I know you can now add new database connections via the admin pages of Servoy server 2.2.
But you also need to reboot the server to make it active (just like you have to when you do it in Developer).
Not sure if you want your clients make your Servoy server restart when they please.
Restarting Servoy server affects all connected clients as you probably know.

Maybe you should talk to Marcel from IT2BE. He made a database manager plugin. Maybe this is what you are looking for.
(see http://forum.servoy.com/viewtopic.php?t=3861)

Hope this helps.

Hi Robert.

No…what I am after is a simple lookup mechanism within the Servoy runtime environment with something like:

db = env.getDatabaseManager().getDatabase()
then…
db.getUsername()
db.getPassword()

db.getDriverName()
etc…

Then, I can use that info to create a new java.sql.Connection myself.
The connection needs to be instantiated within my plugin, so creating a new connection is probably not what I need.

Thanks anyway

julian

Servoy is a three tier solution and you can never go directly to a database without going through the server. It’s not likely we will change that as it has quite some implications on security, caching, broadcasting and performance. You could consider writing a serverside plugin that reads the property file. What exactly would you like to build that needs this functionality?

Hi Jan.

I just posted to the Plugins forum “Servoy Data Stream Plugin”.
That post contains a description of the functionality I have implemented which utilizes a connection for the purposes of streamed reads and writes.

This requirement simply allows me to configure the connection on the user’s behalf. Btw, the connections created this way are well-managed. Under no circumstances would a connection remain open.

cheers
julian