Try my original suggestion:
<data-source key="MRA">

David







From: [EMAIL PROTECTED]
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: Re: Multiple DataSource Problem
Date: Fri, 6 Dec 2002 13:02:34 -0600


Ok I have tried that and I am getting a null pointer exception caused by
the DataSource, here is my code

ServletContext context = servlet.getServletContext();
DataSource dataSource = (DataSource) context.getAttribute("MRA");
conn = dataSource.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);


My struts.xml is this;

<data-sources>
<data-source>
<set-property property="key" value="MRA"/>
<set-property property="driverClass" value
="oracle.jdbc.driver.OracleDriver"/>
<set-property property="url" value="jdbc:oracle:thin:
@147.101.104.63:1524:common"/>
<set-property property="user" value="MRA"/>
<set-property property="password" value="mralog"/>
</data-source>
<data-source>
<set-property property="key" value="PHONE_DB"/>
<set-property property="driverClass" value
="oracle.jdbc.driver.OracleDriver"/>
<set-property property="url" value="jdbc:oracle:thin:
@oid:1521:infoprd"/>
<set-property property="user" value="info_user"/>
<set-property property="password" value="info_user"/>
</data-source>
</data-sources>

I dont see what I am doing wrong please help. Thank you

Tim Bachta
Information Technology
MC 48




"David Graham"
<dgraham1980@hotm To: [EMAIL PROTECTED]
ail.com> cc:
Subject: Re: Multiple DataSource Problem
12/06/2002 12:45
PM
Please respond to
"Struts Users
Mailing List"






From action.execute()

DataSource ds1 =
(DataSource)this.getServlet().getServletContext().getAttribute
("YOUR_DS_KEY"));

David






>From: [EMAIL PROTECTED]
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Subject: Re: Multiple DataSource Problem
>Date: Fri, 6 Dec 2002 12:30:36 -0600
>
>
>Ok , I thought I have already changed the key value's to "MRA" and
>"PHONE_DB" in both of my data-sources, what I am having trouble with is
how
>do I refrence these values in the form and action classes?
>
>
>Tim Bachta
>Information Technology
>MC 48
>
>
>
> "David Graham"
> <dgraham1980@hotm To:
>[EMAIL PROTECTED]
> ail.com> cc:
> Subject: Re: Multiple
>DataSource Problem
> 12/05/2002 04:09
> PM
> Please respond to
> "Struts Users
> Mailing List"
>
>
>
>
>
>
><data-source key="org.apache.struts.action.DATA_SOURCE">
>
>That would store the DataSource under the Struts default value, which
>obviously only allows for one DataSource. Just change the key value to
>something else to store multiple DataSources.
>
>David
>
>
>
>
>
>
> >From: [EMAIL PROTECTED]
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Subject: Re: Multiple DataSource Problem
> >Date: Thu, 5 Dec 2002 15:01:21 -0600
> >
> >
> >Can you show me a code snip of how to use this?
> >
> >
> >Tim Bachta
> >Information Technology
> >MC 48
> >
> >
> >
> >
> > "David Graham"
> > <dgraham1980@hotm To:
> >[EMAIL PROTECTED]
> > ail.com> cc:
> > Subject: Re: Multiple
> >DataSource Problem
> > 12/05/2002 02:45
> > PM
> > Please respond to
> > "Struts Users
> > Mailing List"
> >
> >
> >
> >
> >
> >
> >Use the key attribute of the data-source element.
> >
> >David
> >
> >
> >
> >
> >
> >
> > >From: [EMAIL PROTECTED]
> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > >Subject: Re: Multiple DataSource Problem
> > >Date: Thu, 5 Dec 2002 14:02:31 -0600
> > >
> > >
> > >Did I not give each data-source element its own key?
> > >
> > >Tim Bachta
> > >Information Technology
> > >MC 48
> > >
> > >
> > >
> > >
> > > "David Graham"
> > > <dgraham1980@hotm To:
> > >[EMAIL PROTECTED]
> > > ail.com> cc:
> > > Subject: Re: Multiple
> > >DataSource Problem
> > > 12/05/2002 01:41
> > > PM
> > > Please respond to
> > > "Struts Users
> > > Mailing List"
> > >
> > >
> > >
> > >
> > >
> > >
> > >You need to give each data-source element its own key. Struts stores
>the
> > >DataSource under that key in the ServletContext.
> > >
> > >David
> > >
> > >
> > >
> > >
> > >
> > >
> > > >From: [EMAIL PROTECTED]
> > > >Reply-To: "Struts Users Mailing List"
><[EMAIL PROTECTED]>
> > > >To: [EMAIL PROTECTED]
> > > >Subject: Multiple DataSource Problem
> > > >Date: Thu, 5 Dec 2002 13:20:01 -0600
> > > >
> > > >I am having trouble getting multiple datasources to work in my
> > >application.
> > > >I have searched the archives and found inofrmation on how to do it
>but
> > >the
> > > >solutions given are depricated. Can anyone help me?
> > > >
> > > >
> > > ><data-sources>
> > > > <data-source>
> > > > <set-property property="key" value="MRA"/>
> > > > <set-property property="driverClass" value
> > > >="oracle.jdbc.driver.OracleDriver"/>
> > > > <set-property property="url"
> >value="jdbc:oracle:thin:
> > > >@147.101.104.63:1524:common"/>
> > > > <set-property property="user" value="MRA"/>
> > > > <set-property property="password" value
="mralog"/>
> > > > </data-source>
> > > > <data-source>
> > > > <set-property property="key" value="PHONE_DB"/>
> > > > <set-property property="driverClass" value
> > > >="oracle.jdbc.driver.OracleDriver"/>
> > > > <set-property property="url"
> >value="jdbc:oracle:thin:
> > > >@oid:1521:infoprd"/>
> > > > <set-property property="user" value="info_user"/>
> > > > <set-property property="password"
> >value="info_user"/>
> > > > </data-source>
> > > > </data-sources>
> > > >
> > > >
> > > >
> > > >try
> > > > {
> > > > ServletContext context = servlet.getServletContext();
> > > > DataSource dataSource = (DataSource)
> > > >context.getAttribute(Action.DATA_SOURCE_KEY);
> > > > conn = dataSource.getConnection();
> > > > stmt = conn.createStatement();
> > > > rs = stmt.executeQuery(sql);
> > > >
> > > > Thank you for your help
> > > >
> > > >Tim Bachta
> > > >Information Technology
> > > >MC 48
> > > >
> > > >
> > > >
> > > >
> > > >--
> > > >To unsubscribe, e-mail:
> > > ><mailto:[EMAIL PROTECTED]>
> > > >For additional commands, e-mail:
> > > ><mailto:[EMAIL PROTECTED]>
> > >
> > >
> > >_________________________________________________________________
> > >MSN 8 with e-mail virus protection service: 2 months FREE*
> > >http://join.msn.com/?page=features/virus
> > >
> > >
> > >--
> > >To unsubscribe, e-mail: <
> > >mailto:[EMAIL PROTECTED]>
> > >For additional commands, e-mail: <
> > >mailto:[EMAIL PROTECTED]>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> > >For additional commands, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> >
> >
> >_________________________________________________________________
> >The new MSN 8: advanced junk mail protection and 2 months FREE*
> >http://join.msn.com/?page=features/junkmail
> >
> >
> >--
> >To unsubscribe, e-mail: <
> >mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail: <
> >mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> >
> >
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
>
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*.
>http://join.msn.com/?page=features/featuredemail
>
>
>--
>To unsubscribe, e-mail: <
>mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <
>mailto:[EMAIL PROTECTED]>
>
>
>
>
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>


_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail


--
To unsubscribe, e-mail: <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to