Good day,
I am trying to get coordinate connection pooling using the following:
Tomcat 4.0.4
Postgresql 7.2.1
Turbine 2.1
I have the CLASSPATH pointing to the turbine and velocity jars
withing Tomcat,
and am fairly certain that I have configured
TurbineResources.properties correctly.
>From TurbineResources.properties:
# -------------------------------------------------------------------
#
# D A T A B A S E S E T T I N G S
#
# -------------------------------------------------------------------
# These are your database settings. Look in the
# org.apache.turbine.util.db.pool.* packages for more information.
# The default driver for Turbine is for MySQL.
#
# The parameters to connect to the default database. You MUST
# configure these properly.
# -------------------------------------------------------------------
database.default.driver=org.postgresql.Driver
database.default.url=jdbc:postgresql://blue-diamond.marlboro.edu:5432/
uvre
database.default.username=postgres
database.default.password=postgres
....The adaptors are configured as follows (I found this in the
source code)
# These are the supported JDBC drivers and their associated Turbine
# adaptor. These properties are used by the DBFactory. You can add
# all the drivers you want here.
database.adaptor=DBPostgres
database.adaptor.DBPostgres=org.postgresql.Driver
.....
The Turbine init() appears to run OK (I get the "Ready to Rumble"
message).
Upon trying to access a simple Postgresql database I get the
following
stack trace...
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:532)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at org.apache.turbine.util.db.adapter.DB.getConnection(DB.java:153)
at
org.apache.turbine.util.db.pool.ConnectionPool.getNewConnection(Connec
tionPool.java:498)
at
org.apache.turbine.util.db.pool.ConnectionPool.getConnection(Connectio
nPool.java:339)
at
org.apache.turbine.services.db.TurbinePoolBrokerService.getConnection(
TurbinePoolBrokerService.java:171)
at
org.apache.turbine.services.db.TurbinePoolBrokerService.getConnection(
TurbinePoolBrokerService.java:145)
at
org.apache.turbine.services.db.TurbineDB.getConnection(TurbineDB.java:
169)
at org.apache.jsp.DBPool$jsp._jspService(DBPool$jsp.java:80)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServ
let.java:201)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:38
1)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
cationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
lterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
lve.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.
java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
lve.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.
java:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.
java:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.
java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2
347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
va:180)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.
java:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcher
Valve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.
java:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
va:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.
java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv
e.java:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.
java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.warp.WarpRequestHandler.handle(WarpReque
stHandler.java:217)
at
org.apache.catalina.connector.warp.WarpConnection.run(WarpConnection.j
ava:194)
at java.lang.Thread.run(Thread.java:536)
...
I am running this from a JSP with the following code:
<!-- Hide html from email programs
<%@ page import="org.apache.turbine.util.TurbineConfig" %>
<%@ page import="org.apache.turbine.services.db.TurbineDB" %>
<%@ page import="org.apache.turbine.util.db.pool.DBConnection" %>
<%@ page import="java.sql.*" %>
<%@ page import="org.apache.turbine.util.Log" %>
<html>
<head>
<title>JDBC Smoke Test</title>
</head>
<body>
Test of JDBC with Turbine.
<%
DBConnection dbc = TurbineDB.getConnection();
PreparedStatement ps = dbc.prepareStatement("SELECT * FROM
Customers");
ResultSet rs = ps.executeQuery();
if (rs.next()){
out.print("Got a result set!");
} else {
out.print("No result set found.");
}
rs.close();
ps.close();
TurbineDB.releaseConnection(dbc);
%>
</body>
</html>
End html from email programs -->
If I try using a "standard JDBC call to the same database with the
same connection
details, it works fine. Another thing is that if I take out the
reference to the
Adaptor in TurbineResources.properties, it tells me "No
implementation
for org.postgresql.Driver" in the trace...so I know the string for
the Driver class
is being loaded from TurbineResources.
Any insight would be greatly appreciated. (Should I be using
strictly the TDK?).
Regards,
Mike Clark
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>