cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oskar Werewka <...@poczta.onet.pl>
Subject Re: Problems with turbine-pool
Date Thu, 07 Jun 2001 20:48:56 GMT

Mayby this can help you, I was asking here about using Turbine,
those fragments are not written by me.

///////////////////////////////////////////// one version 
//////////////////////////////////////////////////////////


import org.apache.turbine.services.db.PoolBrokerService;
import org.apache.turbine.util.db.pool.DBConnection;
import org.apache.turbine.services.resources.TurbineResourceService ;
static PoolBrokerService pool = PoolBrokerService.getInstance(); // Turbine
pool of connections
private Connection Conn = null ; // Connection
private DBConnection db = null; // Pooled connection
try {
TurbineResourceService.setPropertiesFileName("C:/jakarta-tomcat-3.2.1/webapp
s/tl/pool/TurbineResources.properties") ;
} catch (IOException ioexp) {
DebugPrint("IO error:" + ioexp.getMessage() ) ;
}
db = pool.getConnection();
Conn = db.getConnection();


////////////////////////////////////////////// second version 
//////////////////////////////////////////////////////


import org.apache.turbine.util.db.pool.ConnectionPool;
import org.apache.turbine.util.db.pool.DBConnection;
import org.apache.turbine.services.resources.TurbineResourceService;
import org.apache.turbine.services.resources.TurbineResources;
import java.sql.*;
import java.util.*;
import java.io.IOException;
class PoolTest{
static{
try{
TurbineResourceService trs = new TurbineResourceService();
Properties prop = new Properties();
prop.setProperty("services.TurbineResourceService.classname",
"org.apache.turbine.services.resources.TurbineResourceService");
prop.setProperty("database.adaptor.DBOracle","oracle.jdbc.driver.OracleDriver");

prop.setProperty("database.adaptor","DBWeblogic,DBOracle,DBInstantDB,
DBPostgres,DBSybase,DBInformix");
prop.setProperty("database.maxConnections","2");
prop.setProperty("database.expiryTime","3600");
trs.setProperties(prop);
}catch(IOException e){
e.printStackTrace();
}
}

public static void main(String argv[])
throws Exception
{
try{
ConnectionPool pool = new ConnectionPool();
DBConnection db =
pool.getConnection("driver","url","user","pwd");
Connection connection = db.getConnection();
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("select * from
….");
resultSet.close();
statement.close();
pool.releaseConnection(db);
}
catch(Exception e){
e.printStackTrace();
}
}
}



At 11:04 07.06.01 -0400, you wrote:
>Hello,
>We are using cocoon1.8.2 .Along with cocoon we got the turbine-pool.jar and
>the documentation from cocoon
>http://xml.apache.org/cocoon/connection-pool.html  says , in order  to
>create the pool use DBBroker class as
>
>static DBBroker pool = DBBroker.getInstance();
>But I get a run time error saying there is no method called getInstance() in
>the DBBroker class .
>So I was wondering if somebody can point me to the version of the
>turbine-pool that came with cocoon and how do
>I get to it .
>
>Thanks
>Siva
>
>
>---------------------------------------------------------------------
>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>



-- 

Ile zarabiasz? Wypelnij ankiete,
dowiesz sie jak zarabiac wiecej [ http://listaplac.onet.pl ]


---------------------------------------------------------------------
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