JTDS help 2005-02-07 - By Charles P. Killmer
Back 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://*.*.*.*:1433/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@(protected) Office: (320) 251-4700 ext 107
|
|