RE: JDBC loop problem tomcat 4.1.18

2003-01-31 Thread Cristian Draghici
Hello all,

I'm replying to my own message.
Seems that switching to jdk 1.3 makes the problem dissapear.

So j2sdk1.4.1.01 does not work with tomcat 4.1.18 for JDBC access (at least
for me on Linux 2.4 kernels)

Cheers
c

-Original Message-
From: Cristian Draghici [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 9:52 PM
To: [EMAIL PROTECTED]
Subject: JDBC loop problem tomcat 4.1.18


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:
-
tcp0  0 localhost.localdo:43556 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43555 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43554 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43553 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43552 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43567 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43566 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43565 localhost.loca:postgres
TIME_WAIT
tcp0  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("");
out.println("");
out.println("");
out.println("SrvText");
out.println("");
out.println("");
out.println("SrvTest " + result + " " + ex + "");
out.println("");
out.println("");


Any ideas will be <> 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]




RE: Cannot load JDBC driver class 'null'

2003-01-30 Thread Cristian Draghici
yes it will

shutdown tomcat and edit the server.xml file by hand.
(add the ResourceParams entry under your context)
add the necessary entries, start tomcat and the admin console should work.

(at least that's what happens with my tomcat 4.1.18)
hope this helps,
cristi

-Original Message-
From: Maris Orbidans [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 11:03 AM
To: Tomcat Users List
Subject: Cannot load JDBC driver class 'null'


hello

I have run into that problem too, I defined a datasource and put driver and
common/lib and defined  in web.xml
of my web. app.  but if throws exception when I try to get a connection from
datasource I have found.

I tried to do it at home with different database with the same result, so I
dont think I have mistyped something.

I know this problem has been adressed before but I havent found any solution
from maillist archives.

BTW I have found one related thing:  If you open Tomcat admin tool, choose
host -> context ->  -> Data sources
it will throw an exception:

org.apache.jasper.JasperException: Exception retrieving attribute
'driverClassName'

so...

I there any known solution ?


Maris Orbidans
www.datapro.lv

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




JDBC loop problem tomcat 4.1.18

2003-01-29 Thread Cristian Draghici
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:
-
tcp0  0 localhost.localdo:43556 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43555 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43554 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43553 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43552 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43567 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43566 localhost.loca:postgres
TIME_WAIT
tcp0  0 localhost.localdo:43565 localhost.loca:postgres
TIME_WAIT
tcp0  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("");
out.println("");
out.println("");
out.println("SrvText");
out.println("");
out.println("");
out.println("SrvTest " + result + " " + ex + "");
out.println("");
out.println("");


Any ideas will be <> 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]