David, Thanks for the quick response...
> 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. No, using newer drivers did not help matters any. I had the exact same error message(s) as before and I must have missed Paul's note note on the mailing list. I had kinda the same feeling about the 'b1' in the name which caused me to think that maybe the JAR file was the problem (even though the classes were all there). > 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? No. I had created a user account specifically for the web application with specific permissions. I thought I was using this account with pgAdmin, but it turns out I wasn't. When I attempted to make a new connection using this username & password, I got an error and realized that I had changed the username (to something more logical) in the database a while back and had forgotten to update the Data Source configuration! Doh! The error message from Struts wasn't all that helpful. It led me to think that my WAR file wasn't correct (but I double-checked it) and/or Tomcat's classpath wasn't correct. Since I was putting the PostgreSQL JAR file into my WEB-INF/lib directory, this shouldn't have been that case. > 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. I only mentioned that I had the PostgreSQL JAR setup as a User Libray in Eclipse and added as a libray to the project to show that all of the classes were being found correctly (so I had a 'complete', and hopefully functional, JAR file). My ant script copies the PostgreSQL JAR file into the WAR file as part of the WAR task (using the 'lib' subtask). I had verifired this several times just to make sure. > 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? At this point, I am still using Struts v1.1, as that is the only version I have any experience using, so I don't know if the DataSource element is still legal under v1.2.x. If you know of a good resource that shows me what the differnces are for v1.2.x, I like to take a look at it to see if it's worth upgrading to. > 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? Yeah, I found out that little gem when I was reading the release notes for one of the milestone builds. Very nice addition since you don't have to have 10+ JAR files all showing up. You can group them into a logical group, like 'Struts v1.1', and have that show up. Again, I only use Sysdeo as an easy means of launching Tomcat from within Eclipse and having the debugger automatically attached to it. I don't use any of the Wizards that come with it. Now that the problem has been resolved, Vic mentioned that this isn't the best approach to be using. He recommended that I always use the container to manage the Data Source Pooling, in particular: "... 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." Everything that I've some across uses the 'org.apache.commons.dbcp.BasicDataSource' or 'org.apache.commons.dbcp.BasicDataSourceFactory' in Tomcat, or building the connection manually in code (not configured in an App Server). How would I use Vic's suggesstion and use the pooled connection source from the PostgreSQL JDBC drivers? Thanks for the help giving my brain a good kicking... ;) -={ Kyle }=- > -----Original Message----- > From: Kyle Korndoerfer [mailto:[EMAIL PROTECTED] > 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 > === message truncated === __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]