This week's book giveaway is in the Testing forum.
We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line!
See this thread for details.
Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PointBase Database under tomcat

Beaumont Muni
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone tried using pointbase database and configuring this successfully under tomcat to use datasource and connection pooling. I trying to use the embedded version 4.5 of the database and have been running into some ClassCastExceptions when I try to connect.
The following is a snippet taken from my server.xml file:
<Context path="/surfmango" docBase="surfmango" debug="0" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_surfmango_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/surfmango" reloadable="true"
auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/surfmango">
<value>jdbc ointbase:embedded:surfmango
I have reference tag setup in my web.xml file as follows (according to suns documentation):

and finally a snippet from my sample class file execute method that uses velocity as a template engine. I am just testing this out. This method does the database connection is as follows:

package com.surfmango;
* Title: Surf Mango PDF eFiling Project
* Description: This service attempts to log a user in to the
* system by accessing a pointbase database using
* tomcat, datasource and pooling.
* Copyright: Copyright (c) 2003
* Company: Surf Mango
* @author Beaumont Muni
* @version 1.0
import java.util.Properties;
import java.sql.*;
import javax.sql.*;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.velocity.context.Context;
import org.apache.velocity.servlet.VelocityServlet;
import com.pointbase.jdbc.*;
import com.adobe.*;
import com.adobe.fdf.*;
public class LoginService implements Service{
public LoginService() {
public Context execute( HttpServletResponse response,
HttpServletRequest request,
Context context)
throws Exception{
javax.naming.Context initCtx = null;
javax.naming.Context envCtx = null;
String login = "";
String password = "";
Connection conn = null;
try {login = request.getParameter("LOGIN");}
catch(Exception e) { e.printStackTrace();}
try {password = request.getParameter("PASSWORD");}
catch(Exception e) {e.printStackTrace();}
// get needed properties
MainProperties mp = new MainProperties();
// Read properties file.
Properties properties = new Properties();
// set up the output stream for printing
}catch(Exception e){
System.out.println("IOException Caught loading:"+mp.PROPERTIES_FILE+": "+e);

//initiate database connectivity
initCtx = new InitialContext();
DataSource ds = (DataSource)envCtx.lookup(mp.DATASOURCE);
// get a connection to the database
conn = ds.getConnection();
// Query the databse for the sales tax rate
Statement stmt = conn.createStatement();
StringBuffer sb = new StringBuffer();
sb.append("WHERE LOGIN = '").append(login).append("'");
sb.append(" AND PASSWORD = '").append(password).append("'");
String query = sb.toString();
System.out.println("QUERY: "+query);
ResultSet rs = stmt.executeQuery(query);
// select login and password from the database
}catch (Exception e){
return context;


If I run this from my sample login form. I get an error indicating that I have a ClassCastException.
I modified the server.xml entry according to suns documentation. My question is has anyone been able to successfully setup pointbase database using datasource connectivity inside of tomcat.
Any kind of help with this regards will be greatly appreciated.
Thanks in advance.
Beaumont Muni
Beaumont Muni
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I originally had the following parameter inserted as part of the <Resourceparams> tag and my class cast exception pointed to using tomcats dbcp resources.
<name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
with the following exception:

java.lang.ClassCastException org.apache.commons.dbcp.BasicDataSourceFactory
When I remove the above tag set the error points to tyrex.jdbc.xa.EnabledDataSource.
Regardless of which datasource I am using, a ClassCastException still occurs.
Thanks again.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic