RE: DB connection pool problem
Well I figured out the problem. The problem was that mysql-connector.jar was not in common/lib of tomcat, but it I had placed in the WEB-INF/lib of my application. Thanks for every body's suggestion. Also just asking curiosity if we keep same jar in both WEB-INF/lib and common/lib, will it create some problem. Thanks. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 4:45 PM To: Tomcat Users List Subject: RE: DB connection pool problem Have you tried to put the configuration text in GlobalNamingResources instead of context block? To me, the message tells that the web.xml and java code is fine. The server.xml is not edited correctly. in you server.xml, you put ResourceParams name=jdbc/conversion, but where is the resource jdbc/conversion? -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 4:07 PM To: Daxin Zuo; Tomcat Users List Subject: RE: DB connection pool problem Hi, Sorry I was messing up my code by making several changes. If I add that statement, I get the following SQL exception is generated Cannot create JDBC driver of class '' for connect URL 'null'. Any idea about what corrections I need to make. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 4:29 PM To: Tomcat Users List Subject: RE: DB connection pool problem You have to add con = dataSource.getConnection(); after dataSource = (DataSource)ctx.lookup(jdbc/conversion); -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 3:54 PM To: David Smith; Tomcat Users List Subject: RE: DB connection pool problem Sorry for creating the confusion. Actually I was seeing the connection object to be null for long time. But at last moment I made those silly changes to present it in a better way. Sorry about it. But now I printing the connection object and finding it to be null. I cannot understand, the reason for connection object to be null, even when datasource object is not null. Is it because that I am not able to connect to database? If yes what could be the reason. If I specify the attributes, using Direct JDBC by using Class.forName() and DriverManager.getConnection(), I can connect to data base and read all the values. But the problem comes when I use Connection pooling. Where shuld I look for correction?? -- Part of my code and JSP o/p - public LinkedList selectCP(){ LinkedList ll = new LinkedList(); Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); } finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); } } try{ ll.add(Inside try.); ll.add(con is); ll.add(con); if(con == null){ ll.add(Inside try. Connection object found to be null); ll.add(con); return ll; } else{ ll.add(Connection object inside else is); ll.add(con);} } } catch(SQLException e) { System.err.println(SQL EXCEPTION+e.getMessage()); ll.add(SQL Exception ); ll.add(e.getMessage()); } catch(Exception e) { System.err.println( class not found exception+e.getMessage()); ll.add(Exception generated:); ll.add(e.getMessage()); } finally{ if(con == null) ll.add(Connection object is null); } try{ stmt.close(); } catch(Exception e){} try{ rs.close(); } catch(Exception e){} try{ con.close(); } catch(Exception e){} return ll; } ---O/P-- --- I am pasting the ll obtained on browser-- [dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside try., con is, null, Inside try. Connection object found to be null, null, Connection object is null] -Original Message
Re: DB connection pool problem
Maybe yes, you could have problem with classpath env variable, I had have this problem with postgresql connector. Regards. Julian Rivera. Arora, Avinash wrote: Well I figured out the problem. The problem was that mysql-connector.jar was not in common/lib of tomcat, but it I had placed in the WEB-INF/lib of my application. Thanks for every body's suggestion. Also just asking curiosity if we keep same jar in both WEB-INF/lib and common/lib, will it create some problem. Thanks. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 4:45 PM To: Tomcat Users List Subject: RE: DB connection pool problem Have you tried to put the configuration text in GlobalNamingResources instead of context block? To me, the message tells that the web.xml and java code is fine. The server.xml is not edited correctly. in you server.xml, you put ResourceParams name=jdbc/conversion, but where is the resource jdbc/conversion? -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 4:07 PM To: Daxin Zuo; Tomcat Users List Subject: RE: DB connection pool problem Hi, Sorry I was messing up my code by making several changes. If I add that statement, I get the following SQL exception is generated Cannot create JDBC driver of class '' for connect URL 'null'. Any idea about what corrections I need to make. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 4:29 PM To: Tomcat Users List Subject: RE: DB connection pool problem You have to add con = dataSource.getConnection(); after dataSource = (DataSource)ctx.lookup(jdbc/conversion); -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 3:54 PM To: David Smith; Tomcat Users List Subject: RE: DB connection pool problem Sorry for creating the confusion. Actually I was seeing the connection object to be null for long time. But at last moment I made those silly changes to present it in a better way. Sorry about it. But now I printing the connection object and finding it to be null. I cannot understand, the reason for connection object to be null, even when datasource object is not null. Is it because that I am not able to connect to database? If yes what could be the reason. If I specify the attributes, using Direct JDBC by using Class.forName() and DriverManager.getConnection(), I can connect to data base and read all the values. But the problem comes when I use Connection pooling. Where shuld I look for correction?? -- Part of my code and JSP o/p - public LinkedList selectCP(){ LinkedList ll = new LinkedList(); Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); } finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); } } try{ ll.add(Inside try.); ll.add(con is); ll.add(con); if(con == null){ ll.add(Inside try. Connection object found to be null); ll.add(con); return ll; } else{ ll.add(Connection object inside else is); ll.add(con);} } } catch(SQLException e) { System.err.println(SQL EXCEPTION+e.getMessage()); ll.add(SQL Exception ); ll.add(e.getMessage()); } catch(Exception e) { System.err.println( class not found exception+e.getMessage()); ll.add(Exception generated:); ll.add(e.getMessage()); } finally{ if(con == null) ll.add(Connection object is null); } try{ stmt.close(); } catch(Exception e){} try{ rs.close(); } catch(Exception e){} try{ con.close(); } catch(Exception e){} return ll; } ---O/P-- --- I am pasting the ll obtained on browser-- [dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside try., con is, null, Inside try
RE: DB connection pool problem
Hi, Sorry I was messing up my code by making several changes. If I add that statement, I get the following SQL exception is generated Cannot create JDBC driver of class '' for connect URL 'null'. Any idea about what corrections I need to make. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 4:29 PM To: Tomcat Users List Subject: RE: DB connection pool problem You have to add con = dataSource.getConnection(); after dataSource = (DataSource)ctx.lookup(jdbc/conversion); -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 3:54 PM To: David Smith; Tomcat Users List Subject: RE: DB connection pool problem Sorry for creating the confusion. Actually I was seeing the connection object to be null for long time. But at last moment I made those silly changes to present it in a better way. Sorry about it. But now I printing the connection object and finding it to be null. I cannot understand, the reason for connection object to be null, even when datasource object is not null. Is it because that I am not able to connect to database? If yes what could be the reason. If I specify the attributes, using Direct JDBC by using Class.forName() and DriverManager.getConnection(), I can connect to data base and read all the values. But the problem comes when I use Connection pooling. Where shuld I look for correction?? -- Part of my code and JSP o/p - public LinkedList selectCP(){ LinkedList ll = new LinkedList(); Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); } finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); } } try{ ll.add(Inside try.); ll.add(con is); ll.add(con); if(con == null){ ll.add(Inside try. Connection object found to be null); ll.add(con); return ll; } else{ ll.add(Connection object inside else is); ll.add(con);} } } catch(SQLException e) { System.err.println(SQL EXCEPTION+e.getMessage()); ll.add(SQL Exception ); ll.add(e.getMessage()); } catch(Exception e) { System.err.println( class not found exception+e.getMessage()); ll.add(Exception generated:); ll.add(e.getMessage()); } finally{ if(con == null) ll.add(Connection object is null); } try{ stmt.close(); } catch(Exception e){} try{ rs.close(); } catch(Exception e){} try{ con.close(); } catch(Exception e){} return ll; } ---O/P-- --- I am pasting the ll obtained on browser-- [dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside try., con is, null, Inside try. Connection object found to be null, null, Connection object is null] -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 1:35 PM To: Tomcat Users List Subject: Re: DB connection pool problem Sorry about the last post. It's been a looonnng day and I didn't read it very well :-(. From what I see, you're comparing conn to null before even attempting to get a connection. Try comparing dataSource to null instead of conn in the second catch block. Then do dataSource.getConnection() if dataSource != null. --David David Smith wrote: I'm a bit confused on your code: try{ // load the driver class file //Class.forName(com.mysql.jdbc.Driver).newInstance(); //establishing the connection if(con == null){ ll.add(Inside 1st try. Connection object found to be null); Why are you doing a Class.forName call after getting a datasource object? I think you're mixing incompatible database access methods. Try doing
RE: DB connection pool problem
Have you tried to put the configuration text in GlobalNamingResources instead of context block? To me, the message tells that the web.xml and java code is fine. The server.xml is not edited correctly. in you server.xml, you put ResourceParams name=jdbc/conversion, but where is the resource jdbc/conversion? -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 4:07 PM To: Daxin Zuo; Tomcat Users List Subject: RE: DB connection pool problem Hi, Sorry I was messing up my code by making several changes. If I add that statement, I get the following SQL exception is generated Cannot create JDBC driver of class '' for connect URL 'null'. Any idea about what corrections I need to make. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 4:29 PM To: Tomcat Users List Subject: RE: DB connection pool problem You have to add con = dataSource.getConnection(); after dataSource = (DataSource)ctx.lookup(jdbc/conversion); -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 3:54 PM To: David Smith; Tomcat Users List Subject: RE: DB connection pool problem Sorry for creating the confusion. Actually I was seeing the connection object to be null for long time. But at last moment I made those silly changes to present it in a better way. Sorry about it. But now I printing the connection object and finding it to be null. I cannot understand, the reason for connection object to be null, even when datasource object is not null. Is it because that I am not able to connect to database? If yes what could be the reason. If I specify the attributes, using Direct JDBC by using Class.forName() and DriverManager.getConnection(), I can connect to data base and read all the values. But the problem comes when I use Connection pooling. Where shuld I look for correction?? -- Part of my code and JSP o/p - public LinkedList selectCP(){ LinkedList ll = new LinkedList(); Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); } finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); } } try{ ll.add(Inside try.); ll.add(con is); ll.add(con); if(con == null){ ll.add(Inside try. Connection object found to be null); ll.add(con); return ll; } else{ ll.add(Connection object inside else is); ll.add(con);} } } catch(SQLException e) { System.err.println(SQL EXCEPTION+e.getMessage()); ll.add(SQL Exception ); ll.add(e.getMessage()); } catch(Exception e) { System.err.println( class not found exception+e.getMessage()); ll.add(Exception generated:); ll.add(e.getMessage()); } finally{ if(con == null) ll.add(Connection object is null); } try{ stmt.close(); } catch(Exception e){} try{ rs.close(); } catch(Exception e){} try{ con.close(); } catch(Exception e){} return ll; } ---O/P-- --- I am pasting the ll obtained on browser-- [dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside try., con is, null, Inside try. Connection object found to be null, null, Connection object is null] -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 1:35 PM To: Tomcat Users List Subject: Re: DB connection pool problem Sorry about the last post. It's been a looonnng day and I didn't read it very well :-(. From what I see, you're comparing conn to null before even attempting to get a connection. Try comparing dataSource to null instead of conn in the second catch block. Then do dataSource.getConnection() if dataSource != null. --David David Smith wrote: I'm a bit
RE: DB connection pool problem
Hi friends, Thanks for your previous feedback. After adding several logging statements in my code, I have found that connection object is null. But dataSource object is not null. What can be reason for it?? Here is how I use it in my code-- public LinkedList testFunction(){ LinkedList ll = null; Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); } finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); // return ll; } } try{ // load the driver class file //Class.forName(com.mysql.jdbc.Driver).newInstance(); //establishing the connection if(con == null){ ll.add(Inside 1st try. Connection object found to be null); } else{ ll.add(Inside 1st try. Connection object is not nul); con = dataSource.getConnection(); stmt = con.createStatement(); } finally{ if(con == null){ ll.add(Connection object is null); // return ll; } --Here is the output that I can see on my jsp page, where I try to print out the linklist obtained from the function above. elements of link list read from database are -[dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside 1st try. Connection object found to be null, Connection object is null] Thanks. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 3:34 PM To: Tomcat Users List Subject: RE: DB connection pool problem I have just created a pool -- I hope it is really a pool. I used jtds jdbc driver to MS SQL Server on Windows. You may find some thing similar. Holp it helps. 1) bellow is the text in tomcat\conf\server.xml GlobalNamingResources Resource name=jdbc/DirectSQL auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/DirectSQL parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value255/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueuser1/value /parameter parameter namepassword/name valuepasswd1/value /parameter parameter namedriverClassName/name valuenet.sourceforge.jtds.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:jtds:sqlserver://serverName:1433/value /parameter /ResourceParams ... 2) bellow is the text in tomcat\conf\Catalina\localhost\ROOT.XML --I create this file by myself Context path= docBase=ROOT debug=0 privileged=true !-- Link to the user database using dbc:jtds:sqlserver -- ResourceLink name=jdbc/DirectSQL global=jdbc/DirectSQL type=javax.sql.DataSource/ /Context This name is used in Java code. global is the name in xml file. they can be different. 3) my test jsp file is in \tomcat\webapps\ROOT\zuo\ Context ctx = new InitialContext(); if (ctx == null) { throw new Exception(Boom - No Context); } DataSource ds = (DataSource) ctx.lookup(java:comp/env/jdbc/DirectSQL); if (ds != null) con = ds.getConnection(); if (con != null){ str = select * from myTable; pStateSearch = con.prepareStatement(str, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY ); rs = pStateSearch.executeQuery(); That's all. -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 3:10 PM To: Tomcat Users List Subject: DB connection pool problem Hi, I am also having the problem with the connection pools. Since I am writing an application first time by using connection pools, I created a test application DBTest. I edited my server.xml and web.xml (of my
RE: DB connection pool problem
Ok, I'll bite. what's the code in ? by chance, do you have something like: con= null; ? You should also clean up that first try block. Remove the if/else block that esentially will *always* report the connection as being null (since you haven't assigned it up to that point). -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 2:52 PM To: Daxin Zuo; Tomcat Users List Cc: [EMAIL PROTECTED] Subject: RE: DB connection pool problem Hi friends, Thanks for your previous feedback. After adding several logging statements in my code, I have found that connection object is null. But dataSource object is not null. What can be reason for it?? Here is how I use it in my code-- public LinkedList testFunction(){ LinkedList ll = null; Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); } finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); // return ll; } } try{ // load the driver class file //Class.forName(com.mysql.jdbc.Driver).newInstance(); //establishing the connection if(con == null){ ll.add(Inside 1st try. Connection object found to be null); } else{ ll.add(Inside 1st try. Connection object is not nul); con = dataSource.getConnection(); stmt = con.createStatement(); } finally{ if(con == null){ ll.add(Connection object is null); // return ll; } --Here is the output that I can see on my jsp page, where I try to print out the linklist obtained from the function above. elements of link list read from database are -[dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside 1st try. Connection object found to be null, Connection object is null] Thanks. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 3:34 PM To: Tomcat Users List Subject: RE: DB connection pool problem I have just created a pool -- I hope it is really a pool. I used jtds jdbc driver to MS SQL Server on Windows. You may find some thing similar. Holp it helps. 1) bellow is the text in tomcat\conf\server.xml GlobalNamingResources Resource name=jdbc/DirectSQL auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/DirectSQL parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value255/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueuser1/value /parameter parameter namepassword/name valuepasswd1/value /parameter parameter namedriverClassName/name valuenet.sourceforge.jtds.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:jtds:sqlserver://serverName:1433/value /parameter /ResourceParams ... 2) bellow is the text in tomcat\conf\Catalina\localhost\ROOT.XML --I create this file by myself Context path= docBase=ROOT debug=0 privileged=true !-- Link to the user database using dbc:jtds:sqlserver -- ResourceLink name=jdbc/DirectSQL global=jdbc/DirectSQL type=javax.sql.DataSource/ /Context This name is used in Java code. global is the name in xml file. they can be different. 3) my test jsp file is in \tomcat\webapps\ROOT\zuo\ Context ctx = new InitialContext(); if (ctx == null) { throw new Exception(Boom - No Context); } DataSource ds = (DataSource) ctx.lookup(java:comp/env/jdbc/DirectSQL); if (ds != null) con = ds.getConnection(); if (con != null){ str
Re: DB connection pool problem
I'm a bit confused on your code: try{ // load the driver class file //Class.forName(com.mysql.jdbc.Driver).newInstance(); //establishing the connection if(con == null){ ll.add(Inside 1st try. Connection object found to be null); Why are you doing a Class.forName call after getting a datasource object? I think you're mixing incompatible database access methods. Try doing dataSource.getConnection() after getting a valid datasource instead. You'll be happier with the result. Take a look at the javadocs for javax.sql.DataSource for more info. --David Arora, Avinash wrote: Hi friends, Thanks for your previous feedback. After adding several logging statements in my code, I have found that connection object is null. But dataSource object is not null. What can be reason for it?? Here is how I use it in my code-- public LinkedList testFunction(){ LinkedList ll = null; Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); } finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); // return ll; } } try{ // load the driver class file //Class.forName(com.mysql.jdbc.Driver).newInstance(); //establishing the connection if(con == null){ ll.add(Inside 1st try. Connection object found to be null); } else{ ll.add(Inside 1st try. Connection object is not nul); con = dataSource.getConnection(); stmt = con.createStatement(); } finally{ if(con == null){ ll.add(Connection object is null); // return ll; } --Here is the output that I can see on my jsp page, where I try to print out the linklist obtained from the function above. elements of link list read from database are -[dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside 1st try. Connection object found to be null, Connection object is null] Thanks. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 3:34 PM To: Tomcat Users List Subject: RE: DB connection pool problem I have just created a pool -- I hope it is really a pool. I used jtds jdbc driver to MS SQL Server on Windows. You may find some thing similar. Holp it helps. 1) bellow is the text in tomcat\conf\server.xml GlobalNamingResources Resource name=jdbc/DirectSQL auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/DirectSQL parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value255/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueuser1/value /parameter parameter namepassword/name valuepasswd1/value /parameter parameter namedriverClassName/name valuenet.sourceforge.jtds.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:jtds:sqlserver://serverName:1433/value /parameter /ResourceParams ... 2) bellow is the text in tomcat\conf\Catalina\localhost\ROOT.XML --I create this file by myself Context path= docBase=ROOT debug=0 privileged=true !-- Link to the user database using dbc:jtds:sqlserver -- ResourceLink name=jdbc/DirectSQL global=jdbc/DirectSQL type=javax.sql.DataSource/ /Context This name is used in Java code. global is the name in xml file. they can be different. 3) my test jsp file is in \tomcat\webapps\ROOT\zuo\ Context ctx = new InitialContext(); if (ctx == null) { throw new Exception(Boom - No Context); } DataSource ds = (DataSource) ctx.lookup(java:comp/env/jdbc/DirectSQL); if (ds != null) con = ds.getConnection(); if (con != null){ str = select * from myTable; pStateSearch = con.prepareStatement(str
Re: DB connection pool problem
Sorry about the last post. It's been a looonnng day and I didn't read it very well :-(. From what I see, you're comparing conn to null before even attempting to get a connection. Try comparing dataSource to null instead of conn in the second catch block. Then do dataSource.getConnection() if dataSource != null. --David David Smith wrote: I'm a bit confused on your code: try{ // load the driver class file //Class.forName(com.mysql.jdbc.Driver).newInstance(); //establishing the connection if(con == null){ ll.add(Inside 1st try. Connection object found to be null); Why are you doing a Class.forName call after getting a datasource object? I think you're mixing incompatible database access methods. Try doing dataSource.getConnection() after getting a valid datasource instead. You'll be happier with the result. Take a look at the javadocs for javax.sql.DataSource for more info. --David Arora, Avinash wrote: Hi friends, Thanks for your previous feedback. After adding several logging statements in my code, I have found that connection object is null. But dataSource object is not null. What can be reason for it?? Here is how I use it in my code-- public LinkedList testFunction(){ LinkedList ll = null;Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); }finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); // return ll; } } try{ // load the driver class file //Class.forName(com.mysql.jdbc.Driver).newInstance(); //establishing the connection if(con == null){ ll.add(Inside 1st try. Connection object found to be null); } else{ ll.add(Inside 1st try. Connection object is not nul); con = dataSource.getConnection(); stmt = con.createStatement(); } finally{ if(con == null){ ll.add(Connection object is null); // return ll; } --Here is the output that I can see on my jsp page, where I try to print out the linklist obtained from the function above. elements of link list read from database are -[dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside 1st try. Connection object found to be null, Connection object is null] Thanks. Avinash Arora -Original Message- From: Daxin Zuo [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 3:34 PM To: Tomcat Users List Subject: RE: DB connection pool problem I have just created a pool -- I hope it is really a pool. I used jtds jdbc driver to MS SQL Server on Windows. You may find some thing similar. Holp it helps. 1) bellow is the text in tomcat\conf\server.xml GlobalNamingResources Resource name=jdbc/DirectSQL auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/DirectSQL parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value255/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueuser1/value /parameter parameter namepassword/name valuepasswd1/value /parameter parameter namedriverClassName/name valuenet.sourceforge.jtds.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:jtds:sqlserver://serverName:1433/value /parameter /ResourceParams ... 2) bellow is the text in tomcat\conf\Catalina\localhost\ROOT.XML --I create this file by myself Context path= docBase=ROOT debug=0 privileged=true !-- Link to the user database using dbc:jtds:sqlserver -- ResourceLink name=jdbc/DirectSQL global=jdbc/DirectSQL type=javax.sql.DataSource/ /Context This name is used in Java code. global is the name in xml file. they can be different. 3) my test jsp file is in \tomcat\webapps\ROOT\zuo\ Context ctx = new InitialContext(); if (ctx == null) { throw new Exception(Boom - No Context
RE: DB connection pool problem
Sorry for creating the confusion. Actually I was seeing the connection object to be null for long time. But at last moment I made those silly changes to present it in a better way. Sorry about it. But now I printing the connection object and finding it to be null. I cannot understand, the reason for connection object to be null, even when datasource object is not null. Is it because that I am not able to connect to database? If yes what could be the reason. If I specify the attributes, using Direct JDBC by using Class.forName() and DriverManager.getConnection(), I can connect to data base and read all the values. But the problem comes when I use Connection pooling. Where shuld I look for correction?? -- Part of my code and JSP o/p - public LinkedList selectCP(){ LinkedList ll = new LinkedList(); Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); } finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); } } try{ ll.add(Inside try.); ll.add(con is); ll.add(con); if(con == null){ ll.add(Inside try. Connection object found to be null); ll.add(con); return ll; } else{ ll.add(Connection object inside else is); ll.add(con);} } } catch(SQLException e) { System.err.println(SQL EXCEPTION+e.getMessage()); ll.add(SQL Exception ); ll.add(e.getMessage()); } catch(Exception e) { System.err.println( class not found exception+e.getMessage()); ll.add(Exception generated:); ll.add(e.getMessage()); } finally{ if(con == null) ll.add(Connection object is null); } try{ stmt.close(); } catch(Exception e){} try{ rs.close(); } catch(Exception e){} try{ con.close(); } catch(Exception e){} return ll; } ---O/P-- --- I am pasting the ll obtained on browser-- [dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside try., con is, null, Inside try. Connection object found to be null, null, Connection object is null] -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 1:35 PM To: Tomcat Users List Subject: Re: DB connection pool problem Sorry about the last post. It's been a looonnng day and I didn't read it very well :-(. From what I see, you're comparing conn to null before even attempting to get a connection. Try comparing dataSource to null instead of conn in the second catch block. Then do dataSource.getConnection() if dataSource != null. --David David Smith wrote: I'm a bit confused on your code: try{ // load the driver class file //Class.forName(com.mysql.jdbc.Driver).newInstance(); //establishing the connection if(con == null){ ll.add(Inside 1st try. Connection object found to be null); Why are you doing a Class.forName call after getting a datasource object? I think you're mixing incompatible database access methods. Try doing dataSource.getConnection() after getting a valid datasource instead. You'll be happier with the result. Take a look at the javadocs for javax.sql.DataSource for more info. --David Arora, Avinash wrote: Hi friends, Thanks for your previous feedback. After adding several logging statements in my code, I have found that connection object is null. But dataSource object is not null. What can be reason for it?? Here is how I use it in my code-- public LinkedList testFunction(){ LinkedList ll = null;Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext
RE: DB connection pool problem
You have to add con = dataSource.getConnection(); after dataSource = (DataSource)ctx.lookup(jdbc/conversion); -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 3:54 PM To: David Smith; Tomcat Users List Subject: RE: DB connection pool problem Sorry for creating the confusion. Actually I was seeing the connection object to be null for long time. But at last moment I made those silly changes to present it in a better way. Sorry about it. But now I printing the connection object and finding it to be null. I cannot understand, the reason for connection object to be null, even when datasource object is not null. Is it because that I am not able to connect to database? If yes what could be the reason. If I specify the attributes, using Direct JDBC by using Class.forName() and DriverManager.getConnection(), I can connect to data base and read all the values. But the problem comes when I use Connection pooling. Where shuld I look for correction?? -- Part of my code and JSP o/p - public LinkedList selectCP(){ LinkedList ll = new LinkedList(); Connection con = null; Statement stmt = null; ResultSet rs = null; DataSource dataSource = null; try{ Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); dataSource = (DataSource)ctx.lookup(jdbc/conversion); ll.add(dataSource object is); ll.add(dataSource); } catch(NamingException e){ System.out.println(Exception thrown is+e.getMessage()); ll.add(Naming Exception thrown); } finally{ if(dataSource == null){ ll.add(DataSource object is null); return ll; } else{ ll.add(Data source object is not null); } } try{ ll.add(Inside try.); ll.add(con is); ll.add(con); if(con == null){ ll.add(Inside try. Connection object found to be null); ll.add(con); return ll; } else{ ll.add(Connection object inside else is); ll.add(con);} } } catch(SQLException e) { System.err.println(SQL EXCEPTION+e.getMessage()); ll.add(SQL Exception ); ll.add(e.getMessage()); } catch(Exception e) { System.err.println( class not found exception+e.getMessage()); ll.add(Exception generated:); ll.add(e.getMessage()); } finally{ if(con == null) ll.add(Connection object is null); } try{ stmt.close(); } catch(Exception e){} try{ rs.close(); } catch(Exception e){} try{ con.close(); } catch(Exception e){} return ll; } ---O/P-- --- I am pasting the ll obtained on browser-- [dataSource object is, [EMAIL PROTECTED], Data source object is not null, Inside try., con is, null, Inside try. Connection object found to be null, null, Connection object is null] -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 1:35 PM To: Tomcat Users List Subject: Re: DB connection pool problem Sorry about the last post. It's been a looonnng day and I didn't read it very well :-(. From what I see, you're comparing conn to null before even attempting to get a connection. Try comparing dataSource to null instead of conn in the second catch block. Then do dataSource.getConnection() if dataSource != null. --David David Smith wrote: I'm a bit confused on your code: try{ // load the driver class file //Class.forName(com.mysql.jdbc.Driver).newInstance(); //establishing the connection if(con == null){ ll.add(Inside 1st try. Connection object found to be null); Why are you doing a Class.forName call after getting a datasource object? I think you're mixing incompatible database access methods. Try doing dataSource.getConnection() after getting a valid datasource instead. You'll be happier with the result. Take a look at the javadocs for javax.sql.DataSource for more info. --David Arora, Avinash wrote: Hi friends, Thanks for your previous feedback. After adding several logging statements in my code, I have found that connection object is null. But dataSource object is not null. What can be reason
RE: DB connection pool problem
You are missing the Resource/ part (needs to be just above ResourceParams/ Resource name=jdbc/conversion auth=Container scope=Sharable type=javax.sql.DataSource/ grts, Pat -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 3:10 PM To: Tomcat Users List Subject: DB connection pool problem Hi, I am also having the problem with the connection pools. Since I am writing an application first time by using connection pools, I created a test application DBTest. I edited my server.xml and web.xml (of my application in following way-- #added to server.xml Context path=/DBTest docBase=DBTest debug=0 reloadable=true ResourceParams name=jdbc/conversion parameter nameusername/name valueROOT/value /parameter parameter namepassword/name valuePASSWORD/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost/DB/value /parameter /ResourceParams /Context #web.xml web-app descriptionMySQL Test App/description resource-ref res-ref-namejdbc/conversion/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app And I added the following statements to my Java class, (which works fine, when I use the connection objects by hardcoding the username and db).-- Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); DataSource dataSource = (DataSource)ctx.lookup(jdbc/conversion); But even after, making these changes, I cannot read any thing from database. I was wondering what more changes I need to made. I also tried to run my JAVA class (DAO) from command line, but I get the following exception-- Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial I tried to print outs the place where exception occurs in my code and found that exception occurs at dataSource = (DataSource)ctx.lookup(jdbc/conversion); Can any body please comment on whats going on wrong? When I run from command line, is tomcat used, I don't think so? So where is the problem? Any ideas?? Avinash Arora - 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]
RE: DB connection pool problem
I have just created a pool -- I hope it is really a pool. I used jtds jdbc driver to MS SQL Server on Windows. You may find some thing similar. Holp it helps. 1) bellow is the text in tomcat\conf\server.xml GlobalNamingResources Resource name=jdbc/DirectSQL auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/DirectSQL parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value255/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueuser1/value /parameter parameter namepassword/name valuepasswd1/value /parameter parameter namedriverClassName/name valuenet.sourceforge.jtds.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:jtds:sqlserver://serverName:1433/value /parameter /ResourceParams ... 2) bellow is the text in tomcat\conf\Catalina\localhost\ROOT.XML --I create this file by myself Context path= docBase=ROOT debug=0 privileged=true !-- Link to the user database using dbc:jtds:sqlserver -- ResourceLink name=jdbc/DirectSQL global=jdbc/DirectSQL type=javax.sql.DataSource/ /Context This name is used in Java code. global is the name in xml file. they can be different. 3) my test jsp file is in \tomcat\webapps\ROOT\zuo\ Context ctx = new InitialContext(); if (ctx == null) { throw new Exception(Boom - No Context); } DataSource ds = (DataSource) ctx.lookup(java:comp/env/jdbc/DirectSQL); if (ds != null) con = ds.getConnection(); if (con != null){ str = select * from myTable; pStateSearch = con.prepareStatement(str, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY ); rs = pStateSearch.executeQuery(); That's all. -Original Message- From: Arora, Avinash [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 3:10 PM To: Tomcat Users List Subject: DB connection pool problem Hi, I am also having the problem with the connection pools. Since I am writing an application first time by using connection pools, I created a test application DBTest. I edited my server.xml and web.xml (of my application in following way-- #added to server.xml Context path=/DBTest docBase=DBTest debug=0 reloadable=true ResourceParams name=jdbc/conversion parameter nameusername/name valueROOT/value /parameter parameter namepassword/name valuePASSWORD/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost/DB/value /parameter /ResourceParams /Context #web.xml web-app descriptionMySQL Test App/description resource-ref res-ref-namejdbc/conversion/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app And I added the following statements to my Java class, (which works fine, when I use the connection objects by hardcoding the username and db).-- Context init = new InitialContext(); Context ctx = (Context) init.lookup(java:comp/env); DataSource dataSource = (DataSource)ctx.lookup(jdbc/conversion); But even after, making these changes, I cannot read any thing from database. I was wondering what more changes I need to made. I also tried to run my JAVA class (DAO) from command line, but I get the following exception-- Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial I tried to print outs the place where exception occurs in my code and found that exception occurs at dataSource = (DataSource)ctx.lookup(jdbc/conversion); Can any body please comment on whats going on wrong? When I run from command line, is tomcat used, I don't think so? So where is the problem? Any ideas?? Avinash Arora - 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]
Re: DB Connection Pool
Jim is actually quite right. I did skip a step. It didn't even occur to me to check the archive because I had done that on the struts archive and reached no conclusion. With poolman unsupported (which I was of the impression most people were using), and needing to have an alternative, I skipped the research and went right to asking questions. My appologies Jim =) I quite understand and agree - I get tons too. I didn't take it as rude or flippit, so please nobody start flaming anyone about it. Thanks for you updated info Jim. Eddie - Original Message - From: Jim Urban [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, March 05, 2002 3:38 PM Subject: RE: DB Connection Pool Why? Because we just had a complete discussion of this topic. Between this list and others I subscribe to, I get hundreds of emails a day and I don't want to wade through the same thing over and over again. Besides, the rule on this list has always been check the archives first. are you the owner of this mailing list? No. Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Lev Assinovsky Sent: Tuesday, March 05, 2002 2:00 PM To: Tomcat Users List Subject: Re: DB Connection Pool Why? Jim, are you the owner of this mailing list? Jim Urban wrote: If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- Lev AssinovskyPeterlink Web ProgrammerSt. Petersburg, Russia Tel/Fax: +7 812 3275343 197022 ul.Chapigina 7Á E-mail: [EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: DB Connection Pool
If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: DB Connection Pool
I join in late, but I'm currently using CodeStudio Poolman for my connection pool. You can customize it to provide object pooling too. It works well for me. Jim Urban wrote: If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: DB Connection Pool
Why? Jim, are you the owner of this mailing list? Jim Urban wrote: If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- Lev AssinovskyPeterlink Web ProgrammerSt. Petersburg, Russia Tel/Fax: +7 812 3275343 197022 ul.Chapigina 7Á E-mail: [EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: DB Connection Pool
On 03/05/2002 02:59 PM, Lev Assinovsky wrote: Why? Jim, are you the owner of this mailing list? Actually, Lev, Jim is right: it's an established etiquette of public mailing lists to first search for an answer in the existing documentation before posting a question on the list. One of the venues of information is the list archive - never aske a question that was sufficiently discussed previously. Eric Raymond wrote a very nice document on asking questions on mailing lists and USENET, and it's available at http://www.tuxedo.org/~esr/faqs/smart-questions.html (pay particular attention to Before you ask section). This document is actually linked from the mailing list subscription page on http://jakarta.apache.org/site/mail.html, which you were supposed to have read before you joined this list. You did read the instructions through, right? Remember: this is a public mailing list for an Open Source Software - we are all stakeholders, not just the list operators. Jim Urban wrote: If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: DB Connection Pool
I'm also using Poolman from CodeStudio. Unfortunately, CodeStudio is no longer supporting it. You can get the Poolman downloads from http://sourceforge.net/project/showfiles.php?group_id=4899, however I'm not sure where you can get the documentation for it. - Original Message - From: Huy Tran [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, March 05, 2002 9:54 AM Subject: Re: DB Connection Pool I join in late, but I'm currently using CodeStudio Poolman for my connection pool. You can customize it to provide object pooling too. It works well for me. Jim Urban wrote: If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: DB Connection Pool
No, Emir! Sorry, I don't agree with you. 1. My post is not off topic 2. I spent few weeks working on the problem before my first post was done. 3. We discovered that the problem isn't that simple. 4. The famous book Professional JSP doesn't recommend to use any custom pooling classes, as Jim advises. 5. We still didn't hear Tomcat/JDBC guru Sincerely, Emir Alikadic wrote: On 03/05/2002 02:59 PM, Lev Assinovsky wrote: Why? Jim, are you the owner of this mailing list? Actually, Lev, Jim is right: it's an established etiquette of public mailing lists to first search for an answer in the existing documentation before posting a question on the list. One of the venues of information is the list archive - never aske a question that was sufficiently discussed previously. Eric Raymond wrote a very nice document on asking questions on mailing lists and USENET, and it's available at http://www.tuxedo.org/~esr/faqs/smart-questions.html (pay particular attention to Before you ask section). This document is actually linked from the mailing list subscription page on http://jakarta.apache.org/site/mail.html, which you were supposed to have read before you joined this list. You did read the instructions through, right? Remember: this is a public mailing list for an Open Source Software - we are all stakeholders, not just the list operators. Jim Urban wrote: If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- Lev AssinovskyPeterlink Web ProgrammerSt. Petersburg, Russia Tel/Fax: +7 812 3275343 197022 ul.Chapigina 7Á E-mail: [EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: DB Connection Pool
Hi, Using connection pools with tomcat or any other J2EE app server or even with most Java programs is really simple. many are free, for example : - www.bitmechanic.com offer JDBC connection pool for free, you only need to write a startup servlet that suits your style. - CodeStudio offers poolman for free, available from sourceforge.com - tyrex jdbc connection pool mechanism comes with Tomcat as explained : http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.htm l Many of the comercial JDBC 2.0 drivers also offer connection pooling, sometimes more optimized than the generic solutions (above). I guess because Tyrex-connection pooling is provided with tomcat your post was probably not off topic. The problem IS simple, solve it and you become one of the Tomcat/JDBC gurus. while (lev.hasMoreQuestions()) { mailingList.ask(lev.getQuestion()); } [EMAIL PROTECTED] -Original Message- From: Lev Assinovsky [mailto:[EMAIL PROTECTED]] Sent: 5. mars 2002 20:46 To: Tomcat Users List Subject: Re: DB Connection Pool No, Emir! Sorry, I don't agree with you. 1. My post is not off topic 2. I spent few weeks working on the problem before my first post was done. 3. We discovered that the problem isn't that simple. 4. The famous book Professional JSP doesn't recommend to use any custom pooling classes, as Jim advises. 5. We still didn't hear Tomcat/JDBC guru Sincerely, Emir Alikadic wrote: On 03/05/2002 02:59 PM, Lev Assinovsky wrote: Why? Jim, are you the owner of this mailing list? Actually, Lev, Jim is right: it's an established etiquette of public mailing lists to first search for an answer in the existing documentation before posting a question on the list. One of the venues of information is the list archive - never aske a question that was sufficiently discussed previously. Eric Raymond wrote a very nice document on asking questions on mailing lists and USENET, and it's available at http://www.tuxedo.org/~esr/faqs/smart-questions.html (pay particular attention to Before you ask section). This document is actually linked from the mailing list subscription page on http://jakarta.apache.org/site/mail.html, which you were supposed to have read before you joined this list. You did read the instructions through, right? Remember: this is a public mailing list for an Open Source Software - we are all stakeholders, not just the list operators. Jim Urban wrote: If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- Lev AssinovskyPeterlink Web ProgrammerSt. Petersburg, Russia Tel/Fax: +7 812 3275343 197022 ul.Chapigina 7Á E-mail: [EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: DB Connection Pool
Reynir Hubner wrote: Hi, Using connection pools with tomcat or any other J2EE app server or even with most Java programs is really simple. many are free, for example : - www.bitmechanic.com offer JDBC connection pool for free, you only need to write a startup servlet that suits your style. - CodeStudio offers poolman for free, available from sourceforge.com - tyrex jdbc connection pool mechanism comes with Tomcat as explained : http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.htm l Many of the comercial JDBC 2.0 drivers also offer connection pooling, sometimes more optimized than the generic solutions (above). I guess because Tyrex-connection pooling is provided with tomcat your post was probably not off topic. The problem IS simple, solve it and you become one of the Tomcat/JDBC gurus. while (lev.hasMoreQuestions()) { mailingList.ask(lev.getQuestion()); } Good joke! Really! Lev breaks out of the loop. Have a good rest! [EMAIL PROTECTED] -Original Message- From: Lev Assinovsky [mailto:[EMAIL PROTECTED]] Sent: 5. mars 2002 20:46 To: Tomcat Users List Subject: Re: DB Connection Pool No, Emir! Sorry, I don't agree with you. 1. My post is not off topic 2. I spent few weeks working on the problem before my first post was done. 3. We discovered that the problem isn't that simple. 4. The famous book Professional JSP doesn't recommend to use any custom pooling classes, as Jim advises. 5. We still didn't hear Tomcat/JDBC guru Sincerely, Emir Alikadic wrote: On 03/05/2002 02:59 PM, Lev Assinovsky wrote: Why? Jim, are you the owner of this mailing list? Actually, Lev, Jim is right: it's an established etiquette of public mailing lists to first search for an answer in the existing documentation before posting a question on the list. One of the venues of information is the list archive - never aske a question that was sufficiently discussed previously. Eric Raymond wrote a very nice document on asking questions on mailing lists and USENET, and it's available at http://www.tuxedo.org/~esr/faqs/smart-questions.html (pay particular attention to Before you ask section). This document is actually linked from the mailing list subscription page on http://jakarta.apache.org/site/mail.html, which you were supposed to have read before you joined this list. You did read the instructions through, right? Remember: this is a public mailing list for an Open Source Software - we are all stakeholders, not just the list operators. Jim Urban wrote: If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- Lev AssinovskyPeterlink Web ProgrammerSt. Petersburg, Russia Tel/Fax: +7 812 3275343 197022 ul.Chapigina 7Á E-mail: [EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- Lev AssinovskyPeterlink Web ProgrammerSt. Petersburg, Russia Tel/Fax: +7 812 3275343 197022 ul.Chapigina 7Á E-mail: [EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: DB Connection Pool
Why? Because we just had a complete discussion of this topic. Between this list and others I subscribe to, I get hundreds of emails a day and I don't want to wade through the same thing over and over again. Besides, the rule on this list has always been check the archives first. are you the owner of this mailing list? No. Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Lev Assinovsky Sent: Tuesday, March 05, 2002 2:00 PM To: Tomcat Users List Subject: Re: DB Connection Pool Why? Jim, are you the owner of this mailing list? Jim Urban wrote: If anyone is currently using a third-part pool that they are well pleased with, I would greatly appreciate that information too. We just finished this discussion. Please check the archive. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- Lev AssinovskyPeterlink Web ProgrammerSt. Petersburg, Russia Tel/Fax: +7 812 3275343 197022 ul.Chapigina 7Á E-mail: [EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]