tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Evesson" <geves...@decentrix.com>
Subject Re: JTDS help
Date Wed, 09 Feb 2005 19:42:48 GMT
Charles P. Killmer wrote:

>I have also tried these methods since.  
>
><%@ page language="java" import="java.sql.*"%>
><%@ page language="java" import="java.util.Properties"%>
><%
>Properties p = new Properties();
>p.put("user", "*****");
>p.put("password", "******");
>Driver d =
>(Driver)Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
>Connection conn =
>d.connect("jdbc:jtds:sqlserver://*.*.*.*:1433;DatabaseName=DBName", p);
>//Connection conn =
>DriverManager.getConnection("jdbc:jtds:sqlserver://*.*.*.*:1433;Database
>Name=DBName", p);
>
>conn.close();
>%> 
>  
>
That way of doing things is always going to be desparately slow. 
Connecting to the database is very heavy weight and very slow. You need 
to use some connection pooling. You'll see an enormous improvement in 
performance. Tomcat has DBCP built in. Look at setting this up. It will 
make an enormous difference. Look at:

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

for details on how to configure this.

-- 

Gary Evesson
Decentrix Inc


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message