You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Frank Renaers <Fr...@ikan.be> on 2004/04/08 11:50:01 UTC
Platform setting and Datasource
Hi,
We are using a jndi Datasource to connect to the database.
<jdbc-connection-descriptor
jcd-alias="descriptor_with_jndi_datasource"
default-connection="true"
PLATFORM="MsSQLServer"
jdbc-level="2.0"
eager-release="false"
batch-mode="false"
useAutoCommit="2"
ignoreAutoCommitExceptions="false"
JNDO-DATASOURCE-NAME="java:comp/env/jdbc/scm4all"
>
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImp
l">
<attribute attribute-name="grabSize" attribute-value="1"/>
</sequence-manager>
</jdbc-connection-descriptor>
The problem is that we have to define a 'platform' setting in the
jdbc-connection-descriptor,
So if a client uses another database, we have to change the platform
setting in repository_database.xml. (i.e. change our WAR file!)
Is there a workaround for this ?
Is it possible to set the platform setting at runtime based on the
specified driver name ?
Thanks,
Frank Renaers - Ikan Software
Re: Platform setting and Datasource
Posted by Armin Waibel <ar...@apache.org>.
Hi Frank,
> Is it possible to set the platform setting at runtime based on the
> specified driver name ?
This shouldn't be a problem. Set all common properties in the repository
file and in a startup class lookup (before the frist use of PB
instances) the jdbc-connection-descriptor and set the missing properties.
ConnectionRepository cr = MetadataManager.
getInstance().connectionRepository();
JdbcConnectionDescriptor jcd = cr.getDescriptor(pbKey);
jcd.setXYZ(...)
...
Or do the whole connection setup at runtime and don't specify a
jdbc-connection descriptor in repository file
http://db.apache.org/ojb/faq.html#Connect%20to%20database%20at%20runtime?
regards,
Armin
Frank Renaers wrote:
> Hi,
>
>
>
> We are using a jndi Datasource to connect to the database.
>
>
>
> <jdbc-connection-descriptor
>
> jcd-alias="descriptor_with_jndi_datasource"
>
> default-connection="true"
>
> PLATFORM="MsSQLServer"
>
> jdbc-level="2.0"
>
> eager-release="false"
>
> batch-mode="false"
>
> useAutoCommit="2"
>
> ignoreAutoCommitExceptions="false"
>
> JNDO-DATASOURCE-NAME="java:comp/env/jdbc/scm4all"
>
>
>
> <sequence-manager
> className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImp
> l">
>
> <attribute attribute-name="grabSize" attribute-value="1"/>
>
> </sequence-manager>
>
> </jdbc-connection-descriptor>
>
>
>
> The problem is that we have to define a 'platform' setting in the
> jdbc-connection-descriptor,
>
> So if a client uses another database, we have to change the platform
> setting in repository_database.xml. (i.e. change our WAR file!)
>
> Is there a workaround for this ?
>
> Is it possible to set the platform setting at runtime based on the
> specified driver name ?
>
>
>
> Thanks,
>
>
>
> Frank Renaers - Ikan Software
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: Platform setting and Datasource
Posted by Thomas Dudziak <to...@first.gmd.de>.
On Thu, 8 Apr 2004, Frank Renaers wrote:
> The problem is that we have to define a 'platform' setting in the
> jdbc-connection-descriptor,
>
> So if a client uses another database, we have to change the platform
> setting in repository_database.xml. (i.e. change our WAR file!)
>
> Is there a workaround for this ?
>
> Is it possible to set the platform setting at runtime based on the
> specified driver name ?
You can set the platform at runtime using the
JdbcConnectionDescriptor.setDbms method (prior to acquiring a persistence
broker) - see here for an
example:
http://db.apache.org/ojb/faq.html#Connect%20to%20database%20at%20runtime?
As to determining the runtime for a given driver, there is the problem
that there is a plethora of drivers for the various databases which even
every once in a while change names (e.g. MySql).
So in order to support this, we would have to keep track of the various
drivers and maintain a map for them ...
Since you have to have a means for your customer to specify the database
driver (which is a change to the jdbc connection descriptor, as well), it
should be no problem to let him specify the platform too ?
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org