You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by abo <oj...@weberhofer.at> on 2004/08/20 15:04:10 UTC
OJB+JNDI Datasource clarification
hi,
I have read some postings about OJB's datasource handling and I'm
confused now.
It's said, that you have to
a.) put username/password both in the datasource.xml and
repository_database.xml or
b.) let username/password blank and give it to the broker (with pbkey)
at runtime.
why is that?
if I tell ojb in repository_database.xml to use a specifc JNDI datasource,
ojb could obtain a connection from this datasource without a
password/username (because they are already configured wihtin the
datasource), so why does ojb need them again?
thanks very much for your answers,
andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: OJB+JNDI Datasource clarification
Posted by Andreas Bohnert <oj...@weberhofer.at>.
thanks anyway!
andreas
Armin Waibel wrote:
> Andreas Bohnert wrote:
>
>> thanks for your quick response, armin!
>>
>> I see, the pwd/user settings in repository_user.xml are optional!
>> ok, that's good, so I have only one problem left. maybe you can give
>> me a hand with this:
>>
>> I have just one ear file with my ejb's, war's, jar's and ojb.sar inside,
>> and I have my datasource.xml which is outside the ear (in the deploy
>> dir).
>>
>> I want to let our customer specify the database connection via the
>> datasource(which driver to use, username, password) without the need
>> to modify our ear file (and the repository files within..)
>>
>> I know how to set the platform at runtime, but how can I figure out
>> which plattform is used?
>> i could open a connection via jndi, get the driver name via metadata
>> and build a mapping from driver name to ojb plattform name.
>>
>> would that be a good solution?
>
>
> I never tried this, but I don't know an alternative solution for your
> specific case (except an automatic .ear generation task) - sorry.
>
> regards,
> Armin
>
>> andreas
>>
>>
>>
>>
>> Armin Waibel wrote:
>>
>>> Hi Andreas,
>>>
>>> please have a look at javadoc of DataSource
>>>
>>> http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html#getConnection(java.lang.String,%20java.lang.String)
>>>
>>>
>>> It is possible to setup DataSource with the ability to specify
>>> user/password at runtime.
>>>
>>> > if I tell ojb in repository_database.xml to use a specifc JNDI
>>> datasource,
>>> > ojb could obtain a connection from this datasource without a
>>> > password/username (because they are already configured wihtin the
>>> > datasource), so why does ojb need them again?
>>>
>>> If your DataSource does not expect user/password, you don't need to
>>> set this in repository_database.
>>> But some user don't want to specify user/password in an
>>> configuration file (in OJB or in the app providing the Datasource),
>>> thus you have to pass it at runtime.
>>>
>>> regards,
>>> Armin
>>>
>>>
>>> abo wrote:
>>>
>>>> hi,
>>>>
>>>> I have read some postings about OJB's datasource handling and I'm
>>>> confused now.
>>>> It's said, that you have to
>>>> a.) put username/password both in the datasource.xml and
>>>> repository_database.xml or
>>>> b.) let username/password blank and give it to the broker (with
>>>> pbkey) at runtime.
>>>>
>>>> why is that?
>>>>
>>>> if I tell ojb in repository_database.xml to use a specifc JNDI
>>>> datasource,
>>>> ojb could obtain a connection from this datasource without a
>>>> password/username (because they are already configured wihtin the
>>>> datasource), so why does ojb need them again?
>>>>
>>>> thanks very much for your answers,
>>>> andreas
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: OJB+JNDI Datasource clarification
Posted by Armin Waibel <ar...@apache.org>.
Andreas Bohnert wrote:
> thanks for your quick response, armin!
>
> I see, the pwd/user settings in repository_user.xml are optional!
> ok, that's good, so I have only one problem left. maybe you can give me
> a hand with this:
>
> I have just one ear file with my ejb's, war's, jar's and ojb.sar inside,
> and I have my datasource.xml which is outside the ear (in the deploy dir).
>
> I want to let our customer specify the database connection via the
> datasource(which driver to use, username, password) without the need to
> modify our ear file (and the repository files within..)
>
> I know how to set the platform at runtime, but how can I figure out
> which plattform is used?
> i could open a connection via jndi, get the driver name via metadata and
> build a mapping from driver name to ojb plattform name.
>
> would that be a good solution?
I never tried this, but I don't know an alternative solution for your
specific case (except an automatic .ear generation task) - sorry.
regards,
Armin
> andreas
>
>
>
>
> Armin Waibel wrote:
>
>> Hi Andreas,
>>
>> please have a look at javadoc of DataSource
>>
>> http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html#getConnection(java.lang.String,%20java.lang.String)
>>
>>
>> It is possible to setup DataSource with the ability to specify
>> user/password at runtime.
>>
>> > if I tell ojb in repository_database.xml to use a specifc JNDI
>> datasource,
>> > ojb could obtain a connection from this datasource without a
>> > password/username (because they are already configured wihtin the
>> > datasource), so why does ojb need them again?
>>
>> If your DataSource does not expect user/password, you don't need to
>> set this in repository_database.
>> But some user don't want to specify user/password in an configuration
>> file (in OJB or in the app providing the Datasource), thus you have to
>> pass it at runtime.
>>
>> regards,
>> Armin
>>
>>
>> abo wrote:
>>
>>> hi,
>>>
>>> I have read some postings about OJB's datasource handling and I'm
>>> confused now.
>>> It's said, that you have to
>>> a.) put username/password both in the datasource.xml and
>>> repository_database.xml or
>>> b.) let username/password blank and give it to the broker (with
>>> pbkey) at runtime.
>>>
>>> why is that?
>>>
>>> if I tell ojb in repository_database.xml to use a specifc JNDI
>>> datasource,
>>> ojb could obtain a connection from this datasource without a
>>> password/username (because they are already configured wihtin the
>>> datasource), so why does ojb need them again?
>>>
>>> thanks very much for your answers,
>>> andreas
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: OJB+JNDI Datasource clarification
Posted by Andreas Bohnert <oj...@weberhofer.at>.
thanks for your quick response, armin!
I see, the pwd/user settings in repository_user.xml are optional!
ok, that's good, so I have only one problem left. maybe you can give me
a hand with this:
I have just one ear file with my ejb's, war's, jar's and ojb.sar inside,
and I have my datasource.xml which is outside the ear (in the deploy dir).
I want to let our customer specify the database connection via the
datasource(which driver to use, username, password) without the need to
modify our ear file (and the repository files within..)
I know how to set the platform at runtime, but how can I figure out
which plattform is used?
i could open a connection via jndi, get the driver name via metadata and
build a mapping from driver name to ojb plattform name.
would that be a good solution?
andreas
Armin Waibel wrote:
> Hi Andreas,
>
> please have a look at javadoc of DataSource
>
> http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html#getConnection(java.lang.String,%20java.lang.String)
>
>
> It is possible to setup DataSource with the ability to specify
> user/password at runtime.
>
> > if I tell ojb in repository_database.xml to use a specifc JNDI
> datasource,
> > ojb could obtain a connection from this datasource without a
> > password/username (because they are already configured wihtin the
> > datasource), so why does ojb need them again?
>
> If your DataSource does not expect user/password, you don't need to
> set this in repository_database.
> But some user don't want to specify user/password in an configuration
> file (in OJB or in the app providing the Datasource), thus you have to
> pass it at runtime.
>
> regards,
> Armin
>
>
> abo wrote:
>
>> hi,
>>
>> I have read some postings about OJB's datasource handling and I'm
>> confused now.
>> It's said, that you have to
>> a.) put username/password both in the datasource.xml and
>> repository_database.xml or
>> b.) let username/password blank and give it to the broker (with
>> pbkey) at runtime.
>>
>> why is that?
>>
>> if I tell ojb in repository_database.xml to use a specifc JNDI
>> datasource,
>> ojb could obtain a connection from this datasource without a
>> password/username (because they are already configured wihtin the
>> datasource), so why does ojb need them again?
>>
>> thanks very much for your answers,
>> andreas
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: OJB+JNDI Datasource clarification
Posted by Armin Waibel <ar...@apache.org>.
Hi Andreas,
please have a look at javadoc of DataSource
http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html#getConnection(java.lang.String,%20java.lang.String)
It is possible to setup DataSource with the ability to specify
user/password at runtime.
> if I tell ojb in repository_database.xml to use a specifc JNDI
datasource,
> ojb could obtain a connection from this datasource without a
> password/username (because they are already configured wihtin the
> datasource), so why does ojb need them again?
If your DataSource does not expect user/password, you don't need to set
this in repository_database.
But some user don't want to specify user/password in an configuration
file (in OJB or in the app providing the Datasource), thus you have to
pass it at runtime.
regards,
Armin
abo wrote:
> hi,
>
> I have read some postings about OJB's datasource handling and I'm
> confused now.
> It's said, that you have to
> a.) put username/password both in the datasource.xml and
> repository_database.xml or
> b.) let username/password blank and give it to the broker (with pbkey)
> at runtime.
>
> why is that?
>
> if I tell ojb in repository_database.xml to use a specifc JNDI datasource,
> ojb could obtain a connection from this datasource without a
> password/username (because they are already configured wihtin the
> datasource), so why does ojb need them again?
>
> thanks very much for your answers,
> andreas
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org