#7 Allow for multiple DB configurations

Undefined
open
nobody
5
2007-05-22
2007-05-22
Bjoern Kimminich
No

It would be great if one could specific more than one database configuration to be profiled by elvyx. This could for example be done by allowing multiple elvyx.properties files (e.g. elvyx_*.properties) and using hibernate.connection.url jdbc:elvyx:* accordingly.

Single DB configuration (as is)

elvyx.properties
----------------
driver=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@localhost:1521:myDB
address=localhost
port=4448
version=1.0.23.1

hibernate.properties
--------------------
hibernate.connection.url jdbc:elvyx:none

Multi DB configuration

elvyx_myDB.properties
---------------------
driver=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@localhost:1521:myDB
address=localhost
port=4448
version=1.0.23.1

elvyx_myOtherDB.properties
--------------------------
driver=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@localhost:1521:myOtherDB
address=localhost
port=4449
version=1.0.23.1

My hibernate.properties
-----------------------
hibernate.connection.url jdbc:elvyx:myDB

My other hibernate.properties
------------------------------
hibernate.connection.url jdbc:elvyx:myOtherDB

Discussion

  • David Newcomb
    David Newcomb
    2007-07-25

    Logged In: YES
    user_id=762346
    Originator: NO

    I too need multiple hosts.
    Having read and rewritten a lot of the Elvyx driver for my own needs, I realised that .properties files is *not* the way forward. The jdbc spec defines a string that can accommodate all those parameters, so that there is no need for any properties files.
    You have to specify this 'spec' in your application anyway so why not make it a bit more useful?

    The Elvyx Driver will need a couple of mods which won't take long. The current implementation does not support DataSources (properly) which will help achieve what you are looking for.

    The jdbc uri may look like these:

    jdbc:elvyx:real=oracle:thin:@localhost:1521:myOtherDB,realdriver=oracle.jdbc.driver.OracleDriver,ehost=localhost,eport=4449,version=1.0.23.1

    or

    jdbc:elvyx:real=mysql://mymachine/mydb?user=me&pass=you,realdriver=com.mysql.jdbc.MySQLDriver,ehost=localhost,eport=4449,version=1.0.23.1