Here's an example of a data-sources.xml file with two different
datasources...
<data-source
name="Default data-source"
class="com.evermind.sql.ConnectionDataSource"
location="jdbc/DefaultDS"
pooled-location="jdbc/DefaultPooledDS"
xa-location="jdbc/xa/DefaultXADS"
ejb-location="jdbc/DefaultEJBDS"
url="jdbc:oracle:thin:@blah.domain.com:1521:dbinstance"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="username"
password="password"
/>
<data-source
name="Othert data-source"
class="com.evermind.sql.ConnectionDataSource"
location="jdbc/OtherDS"
pooled-location="jdbc/OtherPooledDS"
url="jdbc:postgresql://blah.domain.com:5432/postgres"
connection-driver="postgresql.Driver"
username="username"
password="password"
/>
Obviously, in this case, I've got both the Oracle and Postgres drivers in my
orion/lib directory. Then when you want to get a pooled connection, you'd
use...
connection = ((javax.sql.DataSource)
ctx.lookup("jdbc/DefaultPooledDS")).getConnection();
and if you wanted to use the other database, you'd use jdbc/OtherPooledDS
instead of jdbc/DefaultPooledDS.
Hope this helps.
Ralph
>From: Frank Eggink <[EMAIL PROTECTED]>
>Reply-To: Orion-Interest <[EMAIL PROTECTED]>
>To: Orion-Interest <[EMAIL PROTECTED]>
>Subject: How to select an other datasource then the default one?
>Date: Wed, 11 Oct 2000 15:19:04 +0200
>MIME-Version: 1.0
>Received: from [195.84.237.200] by hotmail.com (3.2) with ESMTP id
>MHotMailBBADCD3A0024D82197D8C354EDC808540; Wed Oct 11 08:07:44 2000
>Received: from druid.evermind.net (IDENT:[EMAIL PROTECTED]
>[127.0.0.1])by druid.evermind.net (8.9.3/8.9.3) with SMTP id PAA10617;Wed,
>11 Oct 2000 15:26:20 -0100
>Received: from post.mail.nl.demon.net (post-10.mail.nl.demon.net
>[194.159.73.20])by paladin.evermind.net (8.9.3/8.9.3) with ESMTP id
>QAA06513for <[EMAIL PROTECTED]>; Wed, 11 Oct 2000 16:22:12
>-0400
>Received: from [212.238.78.167] (helo=barabas)by post.mail.nl.demon.net
>with smtp (Exim 3.14 #2)id 13jLql-0003J1-00for
>[EMAIL PROTECTED]; Wed, 11 Oct 2000 13:23:15 +0000
>Received: by localhost with Microsoft MAPI; Wed, 11 Oct 2000 15:19:18 +0200
>From [EMAIL PROTECTED] Wed Oct 11 08:11:44 2000
>Message-ID: <[EMAIL PROTECTED]>
>Organization: De Frisse Jongens
>X-Mailer: Orion ListServer
>Sender: [EMAIL PROTECTED]
>
>Hi, How do you select a different datasource?
>
>I have defined a second data source in the datasources.xml file. Also I
>have added "default-data-source="jdbc/TestEJBDS" to the
>orion-application.xml file in the application-deployments/<application>
>directory, as suggested by the manual.
>
>It doesn't work though,
>Frank
>
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.