Yep! My mistake, I've been brainbusting so much about getting a database
connection it seems there's not much left to get the versions right ;-)
I'm on Struts 1.1-rc1, downloaded last Friday.
Nope, I haven't yet got a connection. Thank you for the other REALY
VALUBLE information, I was clearly way off the "best practice" road.
If it's at all possible for you to help, here's my situation.
I'm running postgresql.
Datapool configured in struts-config:
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property="key" value="logindb"/>
... lotsa more properties ...
</data-source>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property="key" value="userdb"/>
... lotsa more properties ...
</data-source>
</data-sources>
Now for the life of me! I just cannot (or will not? Loooong hours), get
any code written to connect to one of the pools.
Any help will do.
Thanks again for your previous reply David.
Regards,
Johan Wasserman
-----Original Message-----
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: 24 March 2003 16:52
To: [EMAIL PROTECTED]
Subject: Re: [newbie] findDataSource deprecated?
Well, there is no 1.1 RC3 so you must be referring to 1.1 beta 3. It
looks
like others have answered your original question but I wanted to talk
about
your Database class. You should never return a ResultSet into your
Action
or form classes as it maintains an open database connection. You need
to
copy the results into a class like ResultSetDynaClass
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanu
tils/RowSetDynaClass.html
so the db connection can be closed. Also, exposing SQL to your actions
tightly couples them to any changes you make to your database schema. A
useful pattern used to prevent this is called Data Access Object
http://developer.java.sun.com/developer/restricted/patterns/DataAccessOb
ject.html
David
>Hi,
>Im just now converting to rc1.3 and find that findDataSource is
>deprecated. How do you find one of many datasources?
>
>FYI:
>------
>I have a separate class called Database with method runQuery that
>returns a resultset to my ActionForm class, I only pass DBName and
>QueryString as parameters. So my previous code where:
>In ActionForm:
>ResultSet rs = Database.runQuery("logondb", "select username, password
>from users where username = '" + uname + "'");
>
>Many thanks in advance.
>Johan Wasserman.
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]