• 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

PointBase Database under tomcat

Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.io.IOException;
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
    Bookmark Topic Watch Topic
  • New Topic