cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kelly Cole" <>
Subject Connection problem to DB2
Date Thu, 16 May 2002 19:50:16 GMT
I am a new user to Cocoon, just trying to test drive it... One of the things
I would like to do is to connect to our database (db2 on os390 connecting
via DB2/Connect). Unfortunately, I get this entry in the sitemap.log:

DEBUG   (2002-05-16) 10:51.03:468
HttpProcessor[8080][4]/SQLTransformer$Query: SQLTransformer$Query: could not
acquire a Connection -- waiting 5000 ms to try again.

My cocoon.xconf <datasources> element contains:
		<jdbc name="TDB2">
			<pool-controller min="1" max="10"/>
		<jdbc logger="core.datasources.personnel" name="personnel">
			<pool-controller max="10" min="5"/>

My web.xml init-param looks like:
			<param-value> org.hsqldb.jdbcDriver


My sitemap pipeline looks like:
			<map:match pattern="db/*.html">
				<map:generate src="dev/sql-page.xml"/>
				<map:transform type="sql">
					<map:parameter name="use-connection"

I wrote (well, someone gave it to me) the following Java program to prove
that I can connect to the database from Java from my machine...

import java.sql.*;

class Dynamic 
{   static
    {   try
        {   Class.forName ("").newInstance ();
        catch (Exception e)
        {   System.out.println ("\n  Error loading DB2 Driver...\n");
            System.out.println (e);

    public static void main(String argv[])
    {   try 
        {   System.out.println ("  Java Dynamic Sample");
            // Connect to Sample database
            Connection con = null;
            // URL is jdbc:db2:dbname
            String url = "jdbc:db2:tdb2";

            if (argv.length == 0) 
            {   // connect with default id/password
                con = DriverManager.getConnection(url);
            else if (argv.length == 2)
            {   String userid = argv[0];
                String passwd = argv[1];
                // connect with user-provided username and password
                con = DriverManager.getConnection(url, userid, passwd);
            {   throw new Exception("\nUsage: java Dynamic [username

            // Enable transactions

            // Perform dynamic SQL SELECT using JDBC
            {   PreparedStatement pstmt1 = con.prepareStatement(
                   "SELECT creator, name FROM sysibm.systables " +
                   "WHERE name = ? " +
                   "ORDER BY 1"); 
                // set cursor name for the positioned update statement
                pstmt1.setString(1, "SYSGRPS"); 
                ResultSet rs = pstmt1.executeQuery();                       

                while( )                                         
                {   String tableName = rs.getString("name");
                    System.out.println("Table = " + tableName);
            catch( Exception e )
            {   throw e; 
            {   // Rollback the transaction
                System.out.println("\nRollback the transaction...");
                System.out.println("Rollback done.");
        catch( Exception e )
        {   System.out.println(e);

Note that I am new to Java as well as Cocoon. I think Cocoon is the coolest
framework I've ever seen (since I prefer doing all of my coding in

Any help/pointers would be GREATLY APPRECIATED!!! Also, I have tested that
all of the samples work on my machine (except the JSP, which I think I saw
in the faq that I need to do something to get that going anyway)...


Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message