Quantcast

Adding a second data source.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Adding a second data source.

henrydav
I'm currently working with a project that uses a single data source, using default-connection=true in the jdbc-connection-descriptor. I now need to add a second data source, but can I leave the first data source as a default-connection, or do I need to change it and configure the connection programmatically? I'm fairly new to this and I've been reading OJB documentation the past couple of days, but I apologize if I'm leaving out requisite information.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Adding a second data source.

Andrei Harangus
You can leave the first one default and get the second one programmatically.

-----Original Message-----
From: henrydav [mailto:[hidden email]]
Sent: Thursday, April 02, 2009 5:38 PM
To: [hidden email]
Subject: Adding a second data source.


I'm currently working with a project that uses a single data source, using
default-connection=true in the jdbc-connection-descriptor. I now need to add
a second data source, but can I leave the first data source as a
default-connection, or do I need to change it and configure the connection
programmatically? I'm fairly new to this and I've been reading OJB
documentation the past couple of days, but I apologize if I'm leaving out
requisite information.
--
View this message in context:
http://www.nabble.com/Adding-a-second-data-source.-tp22849428p22849428.html
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive
at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: Adding a second data source.

Bernd Längerich
In reply to this post by henrydav
Hi,

You can leave your existing connection as default and add a second (named) connection. You have to specify where to use the second connection by using an appropriate method (i.e. for the PB-API PersistenceBrokerFactory.createPersistenceBroker(new PBKey(jcdalias)) vs. PersistenceBrokerFactory.defaultPersistenceBroker()).

Best regards
Bernd

-----Ursprüngliche Nachricht-----
Von: henrydav [mailto:[hidden email]]
Gesendet: Donnerstag, 2. April 2009 16:38
An: [hidden email]
Betreff: Adding a second data source.


I'm currently working with a project that uses a single data source, using
default-connection=true in the jdbc-connection-descriptor. I now need to add
a second data source, but can I leave the first data source as a
default-connection, or do I need to change it and configure the connection
programmatically? I'm fairly new to this and I've been reading OJB
documentation the past couple of days, but I apologize if I'm leaving out
requisite information.
--
View this message in context: http://www.nabble.com/Adding-a-second-data-source.-tp22849428p22849428.html
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AW: Adding a second data source.

henrydav
Okay, both responses verify what I thought was true, so thank you for that. I've tried the approach you mentioned below (PersistenceBrokerFactory.createPersistenceBroker(new PBKey("myJcdAlias"))), as well as the Spring approach (since this project also mixes Spring 1.2 in):

setJcdAlias("myJcdAlias");
getPersistenceBrokerTemplate();

In both cases, my dataSource is null, which leads me to believe my jcd-alias isn't mapped up properly in the jdbc-connection-descriptor. I guess what I don't understand is how the jcd-alias value is resolved. To what does this attribute directly refer or map?

Thanks for your help, Bernd and Andrei.

Bernd Längerich wrote
Hi,

You can leave your existing connection as default and add a second (named) connection. You have to specify where to use the second connection by using an appropriate method (i.e. for the PB-API PersistenceBrokerFactory.createPersistenceBroker(new PBKey(jcdalias)) vs. PersistenceBrokerFactory.defaultPersistenceBroker()).

Best regards
Bernd

-----Ursprüngliche Nachricht-----
Von: henrydav [mailto:henrydav@indiana.edu]
Gesendet: Donnerstag, 2. April 2009 16:38
An: ojb-user@db.apache.org
Betreff: Adding a second data source.


I'm currently working with a project that uses a single data source, using
default-connection=true in the jdbc-connection-descriptor. I now need to add
a second data source, but can I leave the first data source as a
default-connection, or do I need to change it and configure the connection
programmatically? I'm fairly new to this and I've been reading OJB
documentation the past couple of days, but I apologize if I'm leaving out
requisite information.
--
View this message in context: http://www.nabble.com/Adding-a-second-data-source.-tp22849428p22849428.html
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: AW: Adding a second data source.

Bernd Längerich
Hi,

in my case, I have two connection descriptors:

        <jdbc-connection-descriptor
      jcd-alias="default"
        default-connection="true"
        ...

and

        <jdbc-connection-descriptor
      jcd-alias="remote"
        default-connection="false"
        ...

Using

      localbroker  = PersistenceBrokerFactory.defaultPersistenceBroker();
      remotebroker = PersistenceBrokerFactory.createPersistenceBroker(new PBKey("remote"));

I can access both data bases.

Best regards
Bernd

-----Ursprüngliche Nachricht-----
Von: henrydav [mailto:[hidden email]]
Gesendet: Donnerstag, 2. April 2009 17:33
An: [hidden email]
Betreff: Re: AW: Adding a second data source.


Okay, both responses verify what I thought was true, so thank you for that.
I've tried the approach you mentioned below
(PersistenceBrokerFactory.createPersistenceBroker(new PBKey("myJcdAlias"))),
as well as the Spring approach (since this project also mixes Spring 1.2
in):

setJcdAlias("myJcdAlias");
getPersistenceBrokerTemplate();

In both cases, my dataSource is null, which leads me to believe my jcd-alias
isn't mapped up properly in the jdbc-connection-descriptor. I guess what I
don't understand is how the jcd-alias value is resolved. To what does this
attribute directly refer or map?

Thanks for your help, Bernd and Andrei.


Bernd Längerich wrote:

>
> Hi,
>
> You can leave your existing connection as default and add a second (named)
> connection. You have to specify where to use the second connection by
> using an appropriate method (i.e. for the PB-API
> PersistenceBrokerFactory.createPersistenceBroker(new PBKey(jcdalias)) vs.
> PersistenceBrokerFactory.defaultPersistenceBroker()).
>
> Best regards
> Bernd
>
> -----Ursprüngliche Nachricht-----
> Von: henrydav [mailto:[hidden email]]
> Gesendet: Donnerstag, 2. April 2009 16:38
> An: [hidden email]
> Betreff: Adding a second data source.
>
>
> I'm currently working with a project that uses a single data source, using
> default-connection=true in the jdbc-connection-descriptor. I now need to
> add
> a second data source, but can I leave the first data source as a
> default-connection, or do I need to change it and configure the connection
> programmatically? I'm fairly new to this and I've been reading OJB
> documentation the past couple of days, but I apologize if I'm leaving out
> requisite information.
> --
> View this message in context:
> http://www.nabble.com/Adding-a-second-data-source.-tp22849428p22849428.html
> Sent from the Apache DB - ObjectRelationalBridge Users mailing list
> archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>

--
View this message in context: http://www.nabble.com/Adding-a-second-data-source.-tp22849428p22850281.html
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...