struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David G. Friedman" <hum...@ix.netcom.com>
Subject RE: Problem with PostgreSQL data source
Date Sat, 02 Oct 2004 16:34:19 GMT
Kyle,

Some questions are recaps I didn't see your posted answers for so bear with
me, I'm trying to help:

On Tuesday you wrote that you were going to download the latest drivers from
http://jdbc.postgresql.org/download.html.  Did that help or create any new
error messages?  I ask because Paul wrote that your driver name,
pg73b1jdbc3.jar, has 'b1' in the name suggesting a beta quality driver.

Just to confirm, when you use pgAdmin III, are you using the exact same
username and password as your JDBC setup?  I.E. using the end user database
account  listed in your datasource and not the admin account to connect up?

You also mentioned you are using your PostgreSQL jar as a user library in
Eclipse.  Where is this being copied into your Tomcat deployment?  Is it the
Tomcat shared, Tomcat common or in the WEB-INF/lib of the webapp?  What is
the path in your Eclipse to that jar and what is the path in Tomcat for that
jar?  I ask because you mention your added it to your User Library but a
User Library doesn't require the JAR to be in your webapp /WEB-INF/lib or
even in a Tomcat directory.

And you are still on Struts v1.1 which has the old DataSource support, not
1.2 which I don't think has that anymore, right?

Until you pointed it out (thanks, it helps reduce display clutter), I hadn't
tried user libraries in Eclipse before.  I don't think that carries over to
Tomcat when Sysdeo (which I think you wrote you use) starts Tomcat.  You'd
have to list that jar, if it wasn't in a relevant Tomcat directory, under
windows -> preferences -> Tomcat -> JVM Settings.  Right?

Regards,
David

-----Original Message-----
From: Kyle Korndoerfer [mailto:kkorndoerfer@yahoo.com]
Sent: Saturday, October 02, 2004 11:20 AM
To: Struts Users Mailing List
Subject: Re: Problem with PostgreSQL data source


> 1. You should use the Container (Tomat and not Struts) data source
> and not use connection pool, rather the DataSourcePool that comes
with
> JDBC drivers. Connections are more for clients and PooledDataSource
> is for servers, so use that part of any JDBC driver.

OK, can you show me what the configuration should look like?

The only info I've found is on Tomcat's website, but doesn't mention
anything about using the DataSourcePool drivers from PostgreSQL. This
is what I think my files should look like based on what I've been able
to find online...

===== web.xml snippet ==========
<resource-ref>
  <description>DataSource for PostgreSQL database</description>
  <res-ref-name>jdbc/PostgreSQL</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>
===== web.xml snippet ==========

===== context.xml snippet ==========
<Resource name="jdbc/PostgreSQL" auth="Container"
    type="javax.sql.DataSource" />

<ResourceParams name="jdbc/PostgreSQL">
  <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
  </parameter>
  <parameter>
    <name>driverClassName</name>
    <value>org.postgresql.Driver</value>
  </parameter>
  <parameter>
    <name>url</name>
    <value>jdbc:postgresql://192.168.200.10/testdb</value>
  </parameter>

  <parameter>
    <name>username</name>
    <value>username</value>
  </parameter>
  <parameter>
    <name>password</name>
    <value>password</value>
  </parameter>

  <parameter>
    <name>maxActive</name>
    <value>20</value>
  </parameter>
  <parameter>
    <name>maxIdle</name>
    <value>10</value>
  </parameter>
  <parameter>
    <name>maxIdle</name>
    <value>10</value>
  </parameter>
  <parameter>
    <name>maxWait</name>
    <value>-1</value>
  </parameter>

  <parameter>
    <name>removeAbandoned</name>
    <value>true</value>
  </parameter>
  <parameter>
    <name>removeAbandonedTimeout</name>
    <value>300</value>
  </parameter>
</ResourceParams>
===== context.xml snippet ==========

What needs to change with these file to do like you mentioned?

Do you use the same method to get a connection as you normally would?

===== snippet ==========
Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup( "java:/comp/env" );
DataSource ds = (DataSource)envContext.lookup( "jdbc/PostgreSQL" );
Connection conn = ds.getConnection();
//etc.
===== snippet ==========


> pgSQL rocks!

I agree, which is why I really want to get this working! Thanks for the
help!

>
> good luck.
>
> .V
>
>
> Kyle Korndoerfer wrote:
> > I am not running PostgreSQL on my Windows box. The connection
> string in
> > the Data Source config section is pointing to the SuSE box. I am
> using
> > pgAdmin III on my Windows box to manage the database without error,
> so
> > I can connect to my SuSE box and PostgreSQL without issue.
> >
> > I launch Tomcat from within Eclipse strictly for debugging
> purposes.
> > Even though I am using the Sysdeo plugin (to get the debugging
> > capability), my Ant build script copies the WAR file into the
> > TOMCAT/webapps folder first, then I start Tomcat (I do not use any
> of
> > the deploy tools with the Sysdeo Plugin).
> >
> > The PostgreSQL jar file is configured as a User Library within
> Eclipse
> > and has been added to my Project. I've also tried loading Tomcat
> > individually (not from within Eclipse), but I still get the same
> error.
> >
> > I think the issue is less about being able to actually talk to the
> > server & service, since it can't even load the Driver (which you
> have
> > to do before even attempting to make a connection).
> >
> > The crazy part about this is that I've used the Struts DataSources
> with
> > PostgreSQL in the past without issue.
> >
> > I'm going to download the latest PostgreSQL JDBC drivers tonight
> and
> > see if that makes any difference. Hopefully it will, since I'm
> still
> > utterly stumped...
> >
> > Thanks for the help so far.
> >
> > -={ Kyle }=-
> >
> >
> > --- Paul Woods <lists@nwnetsolutions.net> wrote:
> >
> >
> >>On Mon, 2004-09-27 at 20:57, Kyle Korndoerfer wrote:
> >>
> >>>OK, so my idea (recently upgraded Tomcat to 5.0.28 thinking the
> >>
> >>problem
> >>
> >>>could be thier and forgot to update my $CATALINA_HOME to take that
> >>
> >>into
> >>
> >>>account), but that didn't help...
> >>>
> >>>Still stumped. Anyone? Bueler?
> >>>
> >>>Thanks for any help/suggestions. I've been starring at it so long,
> >>
> >>I
> >>
> >>>know it must be something simple.
> >>>
> >>>-={ Kyle }=-
> >>
> >>David brings up an interesting point.  I'd expand a bit and ask if
> >>you
> >>can connect to the Suse box's postgres via psql (is that available
> >>for
> >>windows?) on your windows box?  psql is a command line client - and
> >>would verify that you have permissions on the suse box to connect
> >>from a
> >>remote client (and that the network setup is correct).
> >>
> >>Something else that crossed my mind.  If you have the JAR in the
> /lib
> >>directory of your webapp, in eclipse, right click on the webapp
> >>project,
> >>and select 'properties'.  Verify that the .jar file is in the
> >>Libraries
> >>tab underneath Java Build Path.  Sometimes just putting in /lib
> isn't
> >>enough.
> >>
> >>
> >>
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> >
> >
> >
> > _______________________________
> > Do you Yahoo!?
> > Declare Yourself - Register online to vote today!
> > http://vote.yahoo.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


=====
-={ Kyle }=-



_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message