Struts stores the datasources as servlet context attributes.
You can access the default datasource in your servlet using -
(DataSource) getServletContext().getAttribute(Globals.DATA_SOURCE_KEY);
Take a look at the struts-config dtd for more info (particularly if you use
modules)
http
ic... another question.
what if it's not a servlet. just a class i made wherein i call it from one
of my action or servlet
but still i will need to use struts datasource. how can it be done.
thanks everyone.
-richard
- Original Message -
From: Steve Raeburn [EMAIL PROTECTED]
To: Struts
Maybe you can pass the datasource as a parameter to the class.
-Message d'origine-
De : Richard Raquepo [mailto:[EMAIL PROTECTED]
Envoyé : lundi 30 juin 2003 8:54
À : Struts Users Mailing List; [EMAIL PROTECTED]
ic... another question.
what if it's not a servlet. just a class i made
You can either pass the datasource from your servlet/action as a method
parameter or you need to register the datasource somewhere that the class
can access.
That might be using JNDI, in which case you probably don't need to configure
your datasource in Struts but in your container.
Another
Another option would be to configure the DS in struts but register it with
a
singleton (Service Locator) that can retrieve the datasource in your data
access classes.
maybe you can give me some link about this? tutorials maybe? any code maybe?
:p
thanks a lot.
- Original Message
- Original Message -
From: Maarten Roosendaal [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 14, 2002 3:42 PM
Subject: DataSource problem
Hi,
I'm trying to create a simple DataBase app. using Struts. Right now i have a
problem with getting the DataSource out of the InitialContext
Good luck to all of us ;)
Rainer
- Original Message -
From: Maarten Roosendaal [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 14, 2002 3:42 PM
Subject: DataSource problem
Hi,
I'm trying to create a simple DataBase app. using Struts. Right now i
have a
problem with getting
i have this data source in my struts-config.xml... this is not a DBCP Connection right?
i doesn't work after i upgraded to RC2
data-source key=DATASOURCE
set-property property=driverClass value=com.mysql.jdbc.Driver /
set-property property=url value=jdbc:mysql://localhost/crmdev /
set
: Cannot load JDBC driver class using Datasource
Connection
Am I missing something here? Tomcat keeps on giving me the following
exception about my JDBC connection driver not being loaded when I try to
establish a
datasource connection to a mysql database in struts :
Initializing application data
Subject: RE: Newbie Q: Cannot load JDBC driver class using Datasource
Connection
I guess u need to put the jdbc2_0-stdext.jar IN THE LIB folder and if u r
using mysql put the
mysql-connector-java-3.0.6-stable-bin.jar also
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent
Am I missing something here? Tomcat keeps on giving me the following
exception about my JDBC connection driver not being loaded when I try to establish a
datasource connection to a mysql database in struts :
Initializing application data source org.apache.struts.action.DATA_SOURCE
do you have your jdbc driver in your classpath?
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 07, 2003 1:59 PM
To: [EMAIL PROTECTED]
Subject: Newbie Q: Cannot load JDBC driver class using Datasource Connection
Am I missing something here
: Cannot load JDBC driver class using Datasource
Connection
do you have your jdbc driver in your classpath?
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 07, 2003 1:59 PM
To: [EMAIL PROTECTED]
Subject: Newbie Q: Cannot load JDBC driver class using
Yes, I have my JDBC driver both in my application's as well as in Tomcat's
classpaths
If you have it in the $TOMCAT_HOME/common/lib, then remove it from you
web-app. It is redundant. Also, are you using the Struts Datasource config
or Tomcat JNDI?
Brandon Goodin
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 07, 2003 12:57 PM
Thanks Brandon , Dimitar, Mark
It's working now : After putting the JDBC driver jar in
$TOMCAT_HOME/common/lib and referencing it in Tomcat's classpath, it's working!
Yep - fandango on core! Had to throw the Big Red Switch.
-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 11:00 PM
Looks like Mark's brain did a core dump...
-Original Message-
From: Scott Barr [mailto:[EMAIL PROTECTED]
Sent: Tuesday,
See the following message for Craig McClanahan's take on this.
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=594323
- Jim
At 10:28 PM 3/24/2003 -0500, you wrote:
I've read the literature and nothing seems definitive. Apparently we can
declare a data source by:
1. Declaring it in
Hi,
How do you connect to a specific datasource pool (as configured in
strusts-config).
I have two pools specified;
key=logindb
key=userdb
ActionServlet.findDataSource is depreciated in rc 1.3
Thanks in advance.
Johan Wasserman
Sorry, that's in Struts 1.1 rc3 that I found
ActionServlet.findDataSource deprecated
-Original Message-
From: Johan Wasserman
Sent: 24 March 2003 14:58
To: '[EMAIL PROTECTED]'
Subject: [newbie] Finding datasource from pool in struts-config
Hi,
How do you connect to a specific
Action.getDataSource( httpSerlvetRequestObject , logindb );
or
Action.getDataSource( httpServletRequest , userdb );
that how i do it in rc1
On Monday 24 March 2003 1:00 pm, Johan Wasserman wrote:
Hi,
How do you connect to a specific datasource pool (as configured in
strusts-config).
I
err...pile of this
-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 10:29 PM
To: struts
Subject: Datasource
I've read the literature and nothing seems definitive. Apparently we can
declare a data source by:
1. Declaring it in struts
err...pile of this... (too many beers...not enough time...)
-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 10:31 PM
To: 'Struts Users Mailing List'
Subject: RE: Datasource
err...pile of this
-Original Message-
From: Mark
Well, this is getting interesting. Why does t - i - h - s comes out
this?
-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 10:42 PM
To: 'Struts Users Mailing List'
Subject: RE: Datasource
err...pile of this... (too many beers...not enough
List'
Subject: RE: Datasource
err...pile of this... (too many beers...not enough time...)
-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 10:31 PM
To: 'Struts Users Mailing List'
Subject: RE: Datasource
err...pile of this
-Original
: Datasource
err...pile of this... (too many beers...not enough time...)
-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 10:31 PM
To: 'Struts Users Mailing List'
Subject: RE: Datasource
err...pile of this
-Original
. Why does t - i - h - s comes out
this?
-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 10:42 PM
To: 'Struts Users Mailing List'
Subject: RE: Datasource
err...pile of this... (too many beers...not enough time...)
-Original
hehe!
-Original Message-
From: Scott Barr [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 10:50 PM
To: Struts Users Mailing List
Subject: Re: Datasource
I thought I'd stumbled onto a fishing mailing list, with those near
references to carp :)
Scott Barr
www.exergonic.com.au
Looks like Mark's brain did a core dump...
-Original Message-
From: Scott Barr [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 25 March 2003 11:50
To: Struts Users Mailing List
Subject: Re: Datasource
I thought I'd stumbled onto a fishing mailing list, with those near
references to carp
I usually pick number two (if you are refering to a jndi datasource)
and leave the configuration to tomcat. So it's possible for me to move
the apps to another app server
without changing my sql code. Just have to configure the same datasource
over in the new app
server.
Mark Galbreath wrote
. The Right Way(TM)
3. The Wrong Way(TM)
4. Actually, you need to declare a reference to 2 here. Not the actual
Datasource
5. See 4.
That help at all?
Thanks,
A.
--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819
my
connection code (which is used the Jakarta pooling stuff) to access a
container managed connection.
Scott Barr
www.exergonic.com.au
On Tue, 2003-03-25 at 14:35, Kwok Peng Tuck wrote:
I usually pick number two (if you are refering to a jndi datasource)
and leave the configuration to tomcat
Two simple questions.
1. I usally define all the datasources i need in struts-config.xml file.
It is very easy, but how can I obtain a datasource reference in my
business logic classes?
I hate the idea of passing the reference to the business methods and I
don't want to include all my business
You will inherit a method from Action called getDataSource() which I
think you should look into. There is a method in action for just
about every handler you would need, including
getResources()
saveMessages()
saveErrors()
getDataSource()
etc..
Check out the API docs for Action.
Dan
--
- -
You can grab the datasource out of the ServletContext. Use JNDI or pass the
DataSource to some ServiceFactory that your business layer can use.
David
From: Guido [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: DataSource references
Thank you. I was searching in ActionServlet class instead of Action.
Now the Eclipse IDE warning singal has disappear and I can sleep again :P
On Sat, 15 Mar 2003, Dan Allen wrote:
} You will inherit a method from Action called getDataSource() which I
} think you should look into. There is a
Guido ([EMAIL PROTECTED]) wrote:
Thank you. I was searching in ActionServlet class instead of Action.
Now the Eclipse IDE warning singal has disappear and I can sleep again :P
Can you sleep for me too? I have no time for that.
Dan
--
- - - - - - - - - - - - - - - - - - - - - - - - - - -
2003 04:52
To: [EMAIL PROTECTED]
Subject: Database datasource runtime configuration
Hi,
I am using the configuration of the datasource/database inside
the
struts-config.xml file.
That 's been giving me some backwards. For example I wish to
change the
hostname
after
-Original Message-
From: Joao Araujo [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 08, 2003 3:52 AM
To: [EMAIL PROTECTED]
Subject: Database datasource runtime configuration
Hi,
I am using the configuration of the datasource/database
inside the
struts-config.xml
Hi,
I am using the configuration of the datasource/database inside the
struts-config.xml file.
That 's been giving me some backwards. For example I wish to change the
hostname
after installing the whole software. I, then, need to open the file and
change the configuration
for this.
I
Hi
Please give me guidlines regarding use of struts datasource.
Regards
Shashi
Please give me guidlines regarding use of struts datasource.
http://jakarta.apache.org/struts/faqs/database.html
Vlad.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
I am a newbie to struts and started with the struts-example application. And modified
it
a bit and learning.. . It looks like there are no separate model classes and all
business
logic exists in the Action classes itself. I am thinking of separate them. The
Datasource
settings are in my struts
Tolle Krez wrote:
I am a newbie to struts and started with the struts-example application. And modified it
a bit and learning.. . It looks like there are no separate model classes and all business
logic exists in the Action classes itself. I am thinking of separate them. The Datasource
settings
I dont think it is good practice to pass datasource from Action class to your business
beans.
http://marc.theaimsgroup.com/?l=struts-userm=104333643909577w=2
http://marc.theaimsgroup.com/?l=struts-userm=104182416102397w=2
I feel using JNDI to get datasource is the best choice. Others - i should
arrangement in that container.
- Original Message -
From: Tolle Krez [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, February 05, 2003 8:42 PM
Subject: Re: Design and Datasource question
I dont think it is good practice to pass datasource from Action
Hi All,
How can i access the datasource outside the action class. suppose i need a
connection in a bean/other class where i need some pre population of data from the
database..
any suggestion woul be a gr8 help.
rgds,
Dinesh
You can store the DataSource in JNDI. An easier way is to configure some
kind of service layer with the datasource.
David
From: Dinesh Sampangi [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Accessing struts datasource outside action
Hey all,
i won't pass the datasource form servlet to backend,
how can i get the datasource outside a servlet ?
Fredy
--
To unsubscribe, e-mail: mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]
JNDI
David
From: Softwareentwicklung Hauschel [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Using Struts Datasource withaout Servlet Context
Date: Thu, 23 Jan 2003 16:37:16 +0100
Hey all,
i won't pass
: Using Struts Datasource withaout Servlet Context
JNDI
David
From: Softwareentwicklung Hauschel [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Using Struts Datasource withaout Servlet Context
Date: Thu, 23
This is more of a design question. I am using Struts and Tomcat, and have set
up a JNDI ref-resource to acquire a DataSource for my database, which works
fine. All of my value objects use the same database.
The question is how to give each value object access to this DataSource.
One option
with the DataSource so
they can persist the objects. This removes all persistence code from the
VOs and allows pluggable persistence layers. I'm using JDBC now but could
move to EJB, OJB, JDO, etc very easily.
David
From: Charlie Toohey [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL
On Wed, 22 Jan 2003, Charlie Toohey wrote:
Date: Wed, 22 Jan 2003 10:31:23 -0800
From: Charlie Toohey [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: accessing DataSource, webapp design question
This is more of a design question. I
: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 10:03 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: linking a struts application to a jndi resource through a
datasource
On 6 Jan 2003, Nick Torenvliet wrote:
Date: 06 Jan 2003 22:46:26 -0500
: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 10:03 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: linking a struts application to a jndi resource through a
datasource
On 6 Jan 2003, Nick Torenvliet wrote:
Date: 06 Jan 2003 22:46:26 -0500
From
application to a jndi resource through a
datasource
On 6 Jan 2003, Nick Torenvliet wrote:
Date: 06 Jan 2003 22:46:26 -0500
From: Nick Torenvliet [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED],
[EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED
Hi, Just as in the examples on the struts site I've succesfully
configured a mysql datasource and had it print the results of queries
from out of an action class. I am using struts 1.1-b2.
I want to replace my current dbpooling(I wrote last year)with the struts
datasource and dbcp, I am having
You can just look up the JNDI datasource in your bean.
- Original Message -
From: Nick Torenvliet [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, January 05, 2003 4:51 PM
Subject: getting a datasource in a bean
Hi, Just as in the examples on the struts site I've succesfully
Sounds like a plan,I've never worked with javax.naming packages before
though, I've got the following datasource
data-source type=org.apache.commons.dbcp.BasicDataSource
key=FIELDSTONE
set-property
property=autoCommit
value=false/
set-property
://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
The instructions for setting up your web.xml file, and for accessing the
data source in a program, are portable across any container that supports
JNDI based data sources. The administrative stuff to configure them is
specific
as org.apache.commons.dbcp.BasicDataSourceFactory),
registering the DataSource with a naming service based on JNDI ?
I was planning on configuring a DataSource with JNDI in web.xml/server.xml
for database access, but then noticed that struts-config.xml has a
data-source entry.
Any opinions ?
- Charlie
--
To unsubscribe, e
registered DataSource
For those using Struts with Tomcat,
Any advantage or difference in using a Struts data source based on the
Jakarta Commons DataBase Connection Pool BasicDataSource class,
vs. using the Tomcat data source using the Jakarta Commons DBCP and
Pool (configuring factory
On Fri, 3 Jan 2003, Charlie Toohey wrote:
Date: Fri, 3 Jan 2003 12:09:29 -0800
From: Charlie Toohey [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Struts data-source vs. Tomcat JNDI registered DataSource
For those using Struts
[EMAIL PROTECTED]
Steven == Steven Dahlin [EMAIL PROTECTED] writes:
Steven When I try to get a datasource which has been defined in the
Steven struts-config.xml no matter what I do the datasource returns back null. My
Steven struts-config.xml for data-sources
When I try to get a datasource which has been defined in the struts-config.xml no
matter what I do the datasource returns back null. My struts-config.xml for
data-sources is:
data-sources
data-source key= conPool
set-property property = autoCommit
Will the data-source key case-sensitive? conPool -- ConPool
Try
dsSrc= ( DataSource ) context.getAttribute( conPool );
Good luck !
- Original Message -
From: Steven Dahlin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 01, 2003 3:42 PM
Subject: datasource
That was a misttype on my part. In the code both have conPool.
- Original Message -
From: Liu Jian [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, January 01, 2003 2:25 PM
Subject: conPool -- ConPool / Re: datasource problem
Will the data-source key
Steven == Steven Dahlin [EMAIL PROTECTED] writes:
Steven When I try to get a datasource which has been defined in the
struts-config.xml no matter what I do the datasource returns back null. My
struts-config.xml for data-sources is:
Steven data-sources
Steven data
I am a little unclear what you mean by using modules?
Steve
- Original Message -
From: David M. Karr [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 01, 2003 3:45 PM
Subject: Re: datasource problem
Steven == Steven Dahlin [EMAIL PROTECTED] writes:
Steven When I
[EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
Date: Thu, 19 Dec 2002 01:14:29 +0100
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Digester - Config.xml - datasource
Hello
I'm wondering whether anyone has every used digester to read in properties
from config.xml
anyone
tried.
Digester newdatasource = new Digester();
newdatasource . addObjectCreate(datasources/datasource, DataSource);
newdatasource
.AddSetProperty(struts-config/datasources/datasource/setproperty,key,my
key²);
newdatasource
.AddSetProperty(struts-config/datasources/datasource/setproperty
Hello
I'm using oracle as my datsource as well, I haven't had this problem but
that in my earlier posting..
So who do you reference the datasource specifed in config.xml in business
logic classes. The docs recommend this seperation but provide no clear way
of doing this, am i missing something
, and require Struts 1.1. The beans can do the business logic
processing as needed. The plug-in has access to the servlet context so can
access the datasource defined in struts-config.xml or in the servlet
container configuration file(s).
Brad
Since it took me several hours to catch this bug, I thought I might pass it
along to anyone using Oracle as a datasource for the Struts application.
The OracleDatSource and OraclePooledConnectionDataSource classes use
standard Bean naming conventions for getters and setters. The url property
] cc:
d.usSubject: Oracle DataSource Tips
]
ail.com cc:
Subject: Re: Multiple DataSource
Problem
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
cc:
Subject: Re: Multiple DataSource
Problem
12/06/2002 01:39
Ok, post your entire data-sources section.
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:57:36 -0600
That gives me a xml parse error
]
ail.com cc:
Subject: Re: Multiple DataSource
Problem
: [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 14:23:55 -0600
data-sources
data-source key=MRA
set-property property=driverClass value
/
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
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
:
Subject: Re: Multiple DataSource
Problem
12/05/2002 01:41
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
:
Subject: Re: Multiple DataSource
Problem
12/05/2002 02:45
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
Hi, people!
Someone can send me a example class with DataSource access
defined on
struts-config? How can I do this? I don find any examples on struts
files.. Thanks again.
--
CUL8R,[]s
Jim Bruno Goldberg
http://www.prosites.com.br
--
To unsubscribe, e-mail: mailto
2002. november 27. 12:49 dátummal Jim Bruno Goldberg ezt írtad:
Hi, people!
Someone can send me a example class with DataSource access
defined on
struts-config? How can I do this? I don find any examples on struts
files.. Thanks again.
Reading the docs?
http
I try this code, but I dont work because I don known where is
dataSource. Can someone a .java complete (with imports)? Thanks a lot.
Gemes Tibor wrote:
2002. november 27. 12:49 dátummal Jim Bruno Goldberg ezt írtad:
Hi, people!
Someone can send me a example class
This is from a PlugIn that has access to the ActionServlet, modify
accordingly:
DataSource ds = (DataSource)
servlet.getServletContext().getAttribute(Globals.DATA_SOURCE_KEY);
David
From: Jim Bruno Goldberg [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts
= theForm.getPassword();
String company = theForm.getCompany();
try {
DataSource dataSource = servlet.findDataSource(null);
Connection conn = dataSource.getConnection();
String query = SELECT
Hello:
I am attempting to write information to a database using a connection
obtained through a dataSource.
Could anyone provide the best approach to write to a database from a session
listener.
I have attempted retrieving the datasource from the servlet context using
the following code snippet
is there any way to access the DataSource defined in
struts-config.xml from within a custom tag.
i usually get it from the ActionServlet context
attribute Action.DATA_SOURCE_KEY from within an
Action.
but its not defined in the pageContext of a tag, so i
assume its not easy to do, though i saw
Andrew,
pageContext.getServletContext().getAttribute(
But, do you really want to do this ?
Mike
At 02:53 05/11/2002 -0800, you wrote:
is there any way to access the DataSource defined in
struts-config.xml from within a custom tag.
i usually get it from the ActionServlet context
PROTECTED] on 11/05/2002 06:04:22 AM
Please respond to Struts Users Mailing List
[EMAIL PROTECTED]
To:Struts Users Mailing List [EMAIL PROTECTED]
cc: (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject:Re: accessing DataSource from custom tag
Andrew,
pageContext.getServletContext
Mailing List [EMAIL PROTECTED]
cc: (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject:Re: accessing DataSource from custom tag
Andrew,
pageContext.getServletContext().getAttribute(
But, do you really want to do this ?
Mike
At 02:53 05/11/2002 -0800, you wrote
Hello...everyone
Does anyone know how to configure datasource externally like using a class?
In Struts, I use struts-config.xml file to configure datasource.
However, how do I configure datasource from a class and make it available
when web application start.
Thanks in advance
You can create a DataSource in a plugin or the ActionServlet and store it in
the ServletContext for later retrieval.
David
From: Kwon Yu [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: How to configure Datasource externally
Date: Mon
101 - 200 of 335 matches
Mail list logo