tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allistair Crossley" <Allistair.Cross...@QAS.com>
Subject RE: JTDS help
Date Tue, 08 Feb 2005 14:44:18 GMT
Hi,

No it was a totally raw test of your code which by virtue of using DriverManager does not
use connection pooling even if I do have it enabled in my web app.

jTDS installation is simply adding the JAR to tomcat/common/lib

Are you running Tomcat on the same server as the database?

Config file won't have anything to do with this. I am certain it is environmental.

Ali.

> -----Original Message-----
> From: Charles P. Killmer [mailto:charlesk@netgaintechnology.com]
> Sent: 08 February 2005 14:41
> To: Tomcat Users List
> Subject: RE: JTDS help
> 
> 
> Well I must have missed something because it isn't working correctly.
> ;)  Were you using connection pooling in your test?  Perhaps I have
> something messed up in a config file?  Or installed jTDS incorrectly?
> 
> Thanks for all your help.
> Charles 
> 
> -----Original Message-----
> From: Allistair Crossley [mailto:Allistair.Crossley@QAS.com] 
> Sent: Tuesday, February 08, 2005 3:17 AM
> To: Tomcat Users List
> Subject: RE: JTDS help
> 
> Hi Charles,
> 
> I've just taken your code and run it through our Tomcat 5.5, jTDS, SQL
> Server 2000 web application and it took approx. 0.5s to compile and
> subsequent requests were instantaneous < 0.5s. 
> 
> I would look again at the issues I first noted, perhaps there is
> something you have missed.
> 
> Cheers, Allistair.
> 
> > -----Original Message-----
> > From: Charles P. Killmer [mailto:charlesk@netgaintechnology.com]
> > Sent: 07 February 2005 22:42
> > To: Tomcat Users List
> > Subject: RE: JTDS help
> > 
> > 
> > When I strip the code to simply this,
> > 
> > <%@ page language="java" import="java.sql.*"%> <% Connection conn =
> > DriverManager.getConnection("jdbc:jtds:sqlserver://*.*.*.*:143
> > 3/dbname;u
> > ser=*****;password=******");
> > conn.close();
> > %>
> > 
> > It still runs slowly.  And yes it is multiple refreshes.  
> > 
> > I have tried to use connection pooling but have not been 
> able to get 
> > it working yet.  Also the thing that I run into with connection 
> > pooling the inability to use the SQL Statement of "select 
> @@IDENTITY 
> > from table".
> > With connection pooling, you run the risk of getting the ID for a 
> > record that someone else inserted with the same connection.
> > 
> > If connection pooling is the only option, I can work around that 
> > issue.
> > But it seems that if PHP, ASP, ASP.NET... Can access the 
> database just
> 
> > fine without connection pooling, JSP should be able to as well.
> > 
> > Any thoughts?
> > Thanks for all your input.
> > Charles
> > 
> > -----Original Message-----
> > From: Mario Winterer [mailto:mario.winterer@eduhi.at]
> > Sent: Monday, February 07, 2005 2:43 PM
> > To: Tomcat Users List
> > Subject: Re: JTDS help
> > 
> > I do not think, jsp compilation is the problem - well, the first 
> > request will last long, but after the jsp is compiled, subsequent 
> > calls will not be remarkable slower than executing pure compiled 
> > servlet code.
> > (Charles, I hope you did not measure the time for the first request 
> > only
> > - which indeed includes compilation time, but for subsequent calls 
> > too).
> > So to me opening the connection is the major problem. 
> Because the code
> 
> > itself contains html-output, I think using jsp is quite ok.
> > The code would be much cleaner, if Charles used the JSTL 
> tag-library:
> > 
> > <%@ page language="java"%>
> > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ 
> > taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %> 
> <sql:query 
> > sql="SELECT * FROM accounts" var="accounts"
> > dataSource="jndi/myDataSource"/>
> > <table>
> > <c:forEach var="acc" items="${accounts}"> <tr> <td><c:out 
> > value="${acc.ID}"/></td> <td><c:out 
> value="${acc.Name}"/></td> </tr> 
> > </c:forEach> </table>
> > 
> > Best regards,
> > Tex
> > 
> > David Smith wrote:
> > 
> > > Ok. You're doing this in a jsp. That means Tomcat is:
> > >
> > > 1) Compiling your jsp to a servlet class.
> > > 2) Building a connection from scratch as opposed to picking up a 
> > > pooled connection
> > > 3) Running the query.
> > >
> > > Of these, the first one is the most expensive operation 
> followed by 
> > > two. If you want fast, try doing this with a pooled 
> connection and 
> > > from compiled servlet code.
> > >
> > > --David
> > >
> > > Charles P. Killmer wrote:
> > >
> > >> Network results
> > >> Ping statistics for *.*.*.*:
> > >> Packets: Sent = 140, Received = 140, Lost = 0 (0% loss),
> > Approximate
> > >> round trip times in milli-seconds:
> > >> Minimum = 0ms, Maximum = 0ms, Average = 0ms Query Analyzer
> > returns 85
> > 
> > >> rows in 0 seconds. I modified it to only return Name and 
> ID and it 
> > >> still runs slow. So it cant be row size, network 
> latency, hardware 
> > >> should be ruled out by the fact that it runs super fast
> > through query
> > 
> > >> analyzer, and PHP and ASP.NET. Its only when I write the
> > code in JSP
> > >> for Tomcat that it slows down.
> > >>
> > >> Charles
> > >>
> > >>
> > >> -----Original Message-----
> > >> From: Allistair Crossley 
> [mailto:Allistair.Crossley@QAS.com] Sent: 
> > >> Monday, February 07, 2005 11:37 AM
> > >> To: Tomcat Users List
> > >> Subject: RE: JTDS help
> > >>
> > >> Hi,
> > >>
> > >> There's no real reason relating to Tomcat or jTDS that
> > this would run
> > 
> > >> slow. You are more likely to find answers with your
> > hardware, network
> > 
> > >> latency, database load or row size and other 
> environmental factors.
> > >>
> > >> Allistair.
> > >>
> > >>
> > >>
> > >>> -----Original Message-----
> > >>> From: Charles P. Killmer [mailto:charlesk@netgaintechnology.com]
> > >>> Sent: 07 February 2005 17:34
> > >>> To: Tomcat Users List
> > >>> Subject: JTDS help
> > >>>
> > >>>
> > >>> I am trying to get Tomcat talking to my database quickly. 
> > This code
> > >>> takes about 2-3 seconds to load. Anyone got any idea's 
> why? Or if 
> > >>> you run this in your environment, how well does it run?
> > >>>
> > >>> <%@ page language="java" import="java.sql.*"%> <%
> > Connection conn =
> > >>> DriverManager.getConnection("jdbc:jtds:sqlserver://*.*.*.*:143
> > >>> 3/dbname;u
> > >>> ser=******;password=*******");
> > >>>
> > >>> Statement stmt = 
> conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,
> > >>> ResultSet.CONCUR_READ_ONLY);
> > >>> ResultSet rs;
> > >>>
> > >>> rs = stmt.executeQuery("SELECT * FROM accounts");
> > >>>
> > >>> out.println("<table>");
> > >>> String name;
> > >>> String ID;
> > >>> while (rs.next()) {
> > >>> name = rs.getString("Name");
> > >>> ID = rs.getString("ID");
> > >>> out.println("<tr><td>" + ID + "</td><td>"+name+"</td></tr>"
); }
> > >>>
> > >>> out.println( "</table>" );
> > >>>
> > >>> conn.close();
> > >>> %>
> > >>>
> > >>> This is just a JSP script, nothing is compiled. I know it
> > is better
> > >>> to compile, but I am trying to chase down this DB 
> slowness first.
> > >>>
> > >>> Charles Killmer
> > >>> Netgain Technology
> > >>> CharlesK@NetgainTechnology.com
> > >>> Office: (320) 251-4700 ext 107
> > >>>
> > >>>
> > >>>
> > >>
> > >>
> > >> <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE>
> > >> -------------------------------------------------------
> > >> QAS Ltd.
> > >> Developers of QuickAddress Software <a 
> > >> href="http://www.qas.com">www.qas.com</a>
> > >> Registered in England: No 2582055
> > >> Registered in Australia: No 082 851 474
> > >> -------------------------------------------------------
> > >> </FONT>
> > >>
> > >>
> > >> 
> > 
> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: 
> tomcat-user-unsubscribe@jakarta.apache.org
> > >> For additional commands, e-mail: 
> > tomcat-user-help@jakarta.apache.org
> > >>
> > >>
> > >> 
> > 
> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: 
> tomcat-user-unsubscribe@jakarta.apache.org
> > >> For additional commands, e-mail: 
> > tomcat-user-help@jakarta.apache.org
> > >>
> > >>
> > >>
> > >
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > >
> > >
> > >
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

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