• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Connection pooling

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i was trying pull connectio pooling features
by replacing
<data-source type="org.apache.struts.legacy.GenericDataSource">
with
<data-source type="org.apache.commons.dbcp.BasicDataSource">
in my struts config xml
=========Struts-config.xml=================
my datasource looks somthing like...
<!-- <data-source type="org.apache.struts.legacy.GenericDataSource">==================================== Data Source Configuration -->
<!-- ==================================== Data Source Configuration -->
<!-- <data-source type="org.apache.commons.dbcp.BasicDataSource">==================================== Data Source Configuration -->
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="autoCommit"
value="false"/>
<set-property property="description"
value="eProject Data Source Configuration"/>
<set-property property="driverClass"
value="org.postgresql.Driver"/>
<set-property property="maxCount"
value="1000"/>
<set-property property="minCount"
value="1"/>
<set-property property="password"
value="test"/>
<set-property property="url"
value="jdbc ostgresql://192.168.1.202/ep"/>
<set-property property="user"
value="pguser"/>
</data-source>

</data-sources>
But while in running my tomcat server it throw a exception....
<!-- <data-source type="org.apache.struts.legacy.GenericDataSource">==================================== Data Source Configuration -->
<!-- ==================================== Data Source Configuration -->
<!-- <data-source type="org.apache.commons.dbcp.BasicDataSource">==================================== Data Source Configuration -->
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="autoCommit"
value="false"/>
<set-property property="description"
value="eProject Data Source Configuration"/>
<set-property property="driverClass"
value="org.postgresql.Driver"/>
<set-property property="maxCount"
value="1000"/>
<set-property property="minCount"
value="1"/>
<set-property property="password"
value="test"/>
<set-property property="url"
value="jdbc ostgresql://192.168.1.202/ep"/>
<set-property property="user"
value="pguser"/>
</data-source>
</data-sources>
============Error from Tomcat=========
SEVERE: Initializing application data source org.apache.struts.action.DATA_SOURCE
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'jdbc ostgresql://192.168.1.202/ep', cause:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:743)
at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:576)
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1087)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1044)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:887)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3948)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4271)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:816)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2343)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
======================================
Can anybody help me ...or advice me a better way for including connection pooling features Thanks ..do help
Lee
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by lee anthony:
hi
i was trying pull connectio pooling features
by replacing
<data-source type="org.apache.struts.legacy.GenericDataSource">
with
<data-source type="org.apache.commons.dbcp.BasicDataSource">
in my struts config xml
=========Struts-config.xml=================
my datasource looks somthing like...
<!-- <data-source type="org.apache.struts.legacy.GenericDataSource">==================================== Data Source Configuration -->
<!-- ==================================== Data Source Configuration -->
<!-- <data-source type="org.apache.commons.dbcp.BasicDataSource">==================================== Data Source Configuration -->
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="autoCommit"
value="false"/>
<set-property property="description"
value="eProject Data Source Configuration"/>
<set-property property="driverClass"
value="org.postgresql.Driver"/>
<set-property property="maxCount"
value="1000"/>
<set-property property="minCount"
value="1"/>
<set-property property="password"
value="test"/>
<set-property property="url"
value="jdbc ostgresql://192.168.1.202/ep"/>
<set-property property="user"
value="pguser"/>
</data-source>

</data-sources>
But while in running my tomcat server it throw a exception....
<!-- <data-source type="org.apache.struts.legacy.GenericDataSource">==================================== Data Source Configuration -->
<!-- ==================================== Data Source Configuration -->
<!-- <data-source type="org.apache.commons.dbcp.BasicDataSource">==================================== Data Source Configuration -->
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="autoCommit"
value="false"/>
<set-property property="description"
value="eProject Data Source Configuration"/>
<set-property property="driverClass"
value="org.postgresql.Driver"/>
<set-property property="maxCount"
value="1000"/>
<set-property property="minCount"
value="1"/>
<set-property property="password"
value="test"/>
<set-property property="url"
value="jdbc ostgresql://192.168.1.202/ep"/>
<set-property property="user"
value="pguser"/>
</data-source>
</data-sources>
============Error from Tomcat=========
SEVERE: Initializing application data source org.apache.struts.action.DATA_SOURCE
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'jdbc ostgresql://192.168.1.202/ep', cause:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:743)
at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:576)
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1087)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1044)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:887)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3948)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4271)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:816)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2343)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
======================================
Can anybody help me ...or advice me a better way for including connection pooling features Thanks ..do help
Lee


What Application server do you use? You should use the connection pooling support from Application server. Configure a datasource and a connection pool in server and your application can use the pool. This way is much better than using connection pooling from Struts which should be used only if your application server does not support connection pooling.
 
lee anthony
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i am using tomcat as my web server ....

please do
Lee
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic