cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niek Bunskoek <Niek.Bunsk...@OVSoftware.com>
Subject Connection Timed Out Problem
Date Wed, 09 May 2001 11:29:28 GMT
Hello everybody,

I have the following problem with Cocoon1.8.3-dev on Tomcat3.2.1 using
JDK1.3.

I wrote a program in Java that automatically increases (database
independent) a primary key from a database (getNextVal();) I invoke this
function in XML like this:

-----------------------------
XML-FILE
-----------------------------

..
<page>

<xsp:logic>
	int id = com.company.module.sql.Sequence.getNextVal("news");
</xsp:logic>

<esql:connection>

	<esql:pool>default</esql:pool>
	
	<esql:execute-query>
  
	    <esql:query>
	    	INSERT INTO news
	    	(id, title)
	    	values (<xsp:expr>id</xsp:expr>,
    			'<request:get-parameter name="title"/>')
	    </esql:query>
	    
    </esql:execute-query>

</esql:connection>

</page>
...

-----------------------------


This is the Java-file:

-----------------------------
JAVA-FILE
-----------------------------
...
import org.apache.turbine.util.db.pool.*;
import org.apache.turbine.services.db.PoolBrokerService;

public class Sequence {

	public static synchronized int getNextVal(String seqName) throws
java.sql.SQLException {
		int returnValue = 0;
		DBConnection con = null;
		PreparedStatement pstmt = null;
		ResultSet rs = null;

		try {
			//creating the DB Connection
			con =
PoolBrokerService.getInstance().getConnection();
	
			...
			// do some stuff
			...
		}

		finally {
			...

			//closing the DB Connection
			if (con != null) {
				try {
	
PoolBrokerService.getInstance().releaseConnection(con);
				}
				
				catch(java.lang.Exception e1) {
					throw new
java.sql.SQLException(e1.getMessage());
				}
			}
		}
		return returnValue;
	}
}

-----------------------------


Here are my Turbine Settings:

----------------------------------------------------------
Turbine DB Connection Pool
----------------------------------------------------------

# These are your database settings, look in the
# org.apache.turbine.util.db.pool.* package for more information.

processor.xsp.pool.database.default.driver=org.gjt.mm.mysql.Driver
processor.xsp.pool.database.default.url=jdbc:mysql://ovspc63/cms
processor.xsp.pool.database.default.username=admin
processor.xsp.pool.database.default.password=admin
processor.xsp.pool.database.default.maxConnections=100
processor.xsp.pool.database.default.expiryTime=36000000

# These are the supported jdbc-drivers and their adaptors.
# These properties are used by the DBFactory.
processor.xsp.pool.database.adaptor=DBMM
processor.xsp.pool.database.adaptor.DBMM=org.gjt.mm.mysql.Driver
#processor.xsp.pool.database.adaptor=DBWeblogic,DBOracle,DBInstantDB,DBPostg
res,DBSybase,DBInformix
#processor.xsp.pool.database.adaptor.DBWeblogic=weblogic.jdbc.pool.Driver
#processor.xsp.pool.database.adaptor.DBOracle=oracle.jdbc.driver.OracleDrive
r
#processor.xsp.pool.database.adaptor.DBInstantDB=org.enhydra.instantdb.jdbc.
idbDriver
#processor.xsp.pool.database.adaptor.DBPostgres=postgresql.Driver
#processor.xsp.pool.database.adaptor.DBInformix=com.informix.jdbc.IfxDriver
#processor.xsp.pool.database.adaptor.DBSybase=com.sybase.jdbc.SybDriver
----------------------------------------------------------


-----------------------------
MY PROBLEM
-----------------------------

I can invoke the xml-file 10 times before it shows the following error:

java.sql.SQLException: Timed out waiting for pooled connection from
'jdbc:mysql://ovspc63/cms'
	at com.ovsoftware.ocms.sql.Sequence.getNextVal(Sequence.java:60)
	at
_C_._winapp._tomcocjet._webapps._cocoon._ocms._contribution._news._insert_co
n_news.populateDocument(_insert_con_news.java:169)
	at
org.apache.cocoon.processor.xsp.XSPPage.getDocument(XSPPage.java:97)
	at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:518)
	at org.apache.cocoon.Engine.handle(Engine.java:376)
	at org.apache.cocoon.Cocoon.service(Cocoon.java:183)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
	at org.apache.tomcat.core.Handler.service(Handler.java:286)
	at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
	at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
	at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
	at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
	at java.lang.Thread.run(Thread.java:484)

I don't know what to do...

Can anybody help me?

Regards,

Niek



**********************************************************************
As you are aware, e-mails sent via Internet can easily be prepared or
manipulated by third persons, For this reason we trust you will understand
that, for your own and our protection, we rule out the legal validity of the
foregoing statements and comments. The applicable regulations of OVSoftware
on the legal validity of declarations of intent of a binding nature remain
unaffected.
This message is confidential. It may also be privileged or otherwise
protected by legal rules. It may be unlawful for you to read, copy or use it
in anyway. If you have received it by mistake please let us know by reply
and then delete it from your system.



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message