Hello All, I have installed tomcat 4.1.18, I have a postgresql 7.0.3 database, the jdbc driver is jdbc7.0-1.1.jar. I have a servlet that is supposed to execute a very simple query (select count) from the database.
Althouh I get a context and the driver gets loaded, I get connections to postgres but nothing happens Here's what netstat shows: --------------------------------- tcp 0 0 localhost.localdo:43556 localhost.loca:postgres TIME_WAIT tcp 0 0 localhost.localdo:43555 localhost.loca:postgres TIME_WAIT tcp 0 0 localhost.localdo:43554 localhost.loca:postgres TIME_WAIT tcp 0 0 localhost.localdo:43553 localhost.loca:postgres TIME_WAIT tcp 0 0 localhost.localdo:43552 localhost.loca:postgres TIME_WAIT tcp 0 0 localhost.localdo:43567 localhost.loca:postgres TIME_WAIT tcp 0 0 localhost.localdo:43566 localhost.loca:postgres TIME_WAIT tcp 0 0 localhost.localdo:43565 localhost.loca:postgres TIME_WAIT tcp 0 0 localhost.localdo:43564 localhost.loca:postgres TIME_WAIT [and it goes on and on] --------------------------------- Here's an excerpt from the code(almost all of it actually): ---------------------------------- try { Context initContext = new InitialContext(); if(initContext == null) throw new Exception("NULL initial context"); Context envContext = (Context)initContext.lookup("java:/comp/env"); if(envContext == null) throw new Exception("NULL /comp/env context"); DataSource ds = (DataSource)envContext.lookup("jdbc/mydb"); if(ds == null) throw new Exception("Could not access data source"); Connection conn = ds.getConnection(); if(conn == null) throw new Exception("Could not open connection"); Statement stmt = conn.createStatement(); String query = "select count(*) from aaa_user"; ResultSet table = stmt.executeQuery(query); while(table.next()) { result = table.getLong(1); } stmt.close(); conn.close(); } catch(Exception e) { ex = e.getMessage(); } PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<body>"); out.println("<head>"); out.println("<title>SrvText</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>SrvTest " + result + " " + ex + "</h1>"); out.println("</body>"); out.println("</html>"); ------------------------------------ Any ideas will be <<greatly>> appreciated :-) Thank you, Cristi PS. I get the same behavior with an Oracle database so I guess postgres is innocent. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]