RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server using JNDI and Connection Pooling?

2005-08-24 Thread Allistair Crossley
Hey Ian,

Great that you got that working in the end. Did you find out what caused the 
issues? I'm not convinced you need to use the ConnectionPoolDataSource, since 
that's what DBCP is doing for you (I think - please someone correct me if I am 
wrong). You could try using javax.sql.ConnectionPoolDataSource in your res-type 
and in the JNDI configuration, but I am not sure if DBCP will allow you to do 
that. Have a go. I just use the DataSource implementation and we've had great 
success and performance with it.

Cheers, Allistair.

 -Original Message-
 From: Wylie, Ian [mailto:[EMAIL PROTECTED]
 Sent: 24 August 2005 12:33
 To: Tomcat Users List
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 using JNDI and Connection Pooling?
 
 
 Hi Allistair,
 
 I just got the basic JNDI datasource working for MS SQL 
 Server with Tomcat
 5.5.
 
 I tried using the ConnectionPoolDataSource instead of the standard
 DataSource but I cannot get this working.
 
 Not sure whether I need to replace the
 res-typejavax.sql.DataSource/res-type with something else 
 in the web.xml
 file.
 
 I changed the driverclass name from the standard datasource class of
 com.microsoft.jdbc.sqlserver.SQLServerDriver - used with 
 standard datasource
 to the com.microsoft.jdbcx.sqlserver.SQLServerDataSource 
 class used by MS
 connection pooling in the 
 TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
 file.  Also added the factory for PooledConnections -
 factory=com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFact
 ory to the
 TOMCAT_HOME/conf/Catalina/localhost/webappname.xml file. 
 
 Any ideas to get the MS Connection Pooling working, or is 
 there no need in
 Tomcat 5.5  -   In aother words does Tomcat 5.5 automatically 
 used Cnnection
 Pooling with a datasource??
 
 Many thanks for your help with this.
 
 Best Regards,
 
 Ian
 
 
 -Original Message-
 From: Allistair Crossley [mailto:[EMAIL PROTECTED]
 Sent: 23 August 2005 16:05
 To: Tomcat Users List; [EMAIL PROTECTED]
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 usin g JNDI?
 
 
 Hi Wade,
 
 Can you perhaps resend the configuration files
 
 server.xml
 web.xml
 yourapp.xml
 listing of files in common/lib
 listing of files in yourapp/WEB-INF/lib
 
 Again?
 
 Cheers, Allistair.
 
  -Original Message-
  From: Wade Chandler [mailto:[EMAIL PROTECTED]
  Sent: 22 August 2005 17:58
  To: Tomcat Users List
  Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS 
 SQL Server
  usin g JNDI?
  
  
  --- Wylie, Ian [EMAIL PROTECTED] wrote:
  
   Allistair,
   
   My apologies for taking much longer than usual to
   get back to you but I had
   to finish some Java code that allowed us to upgrade
   our portal to PlumTree
   version 5.
   
   To clarify and answer your points below.
   
   1)  I have opted not to have a context.xml file in
   the META-INF directory
   but I am using the 
   TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
   file
   instead.
   
   2)  I  have ensured that the 3 MS JAR files for the
   JDBC connection exist
   only in TOMCAT_HOME/common/lib and not in my webapp
   lib.
   
   3)  I have changed the java code to use a simple
   'DataSource' instead of a
   'ConnectionPoolDataSource' connection.  See Java
   code snippet below :-
   
   Unfortunately I still get the error below :-
   
   ERROR - NamingException - Config error with JNDI
   and
   datasource.javax.naming.NamingException: Cannot
   create resource instance
   ERROR com.webconnex.cognos.PORT.OMTLreport  : Cannot
   create resource
   instance
   
   I have attached my web.xml and
   TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
   files for your perusal.
   
   
   I am of yet no further forward in solving my
   problem.
   
   Any further insight would be appreciated, as Tomcat
   5 allows me to do quite
   a few things better, not least of which is
   debugging!!
   
   
   Java Code snippet :-
   
  
  =
   
   logger.debug(Before
   InitialContext.) ;
   InitialContext ctx = new
   InitialContext();
   if (ctx == null) { 
   log(ERROR initialising
   InitialContext.) ;  
   logger.error(ERROR initialising
   InitialContext.) ;
   }
   log(Before Context.) ;
   ds = (DataSource)
   ctx.lookup(java:comp/env/jdbc/UKportalPool);
   
   log(Before initialising
   DataSource.) ;
   
   if(ds != null) {
   con = ds.getConnection();
   if (con != null) {
 
 if ((pType != null) 
   (!pType.equals()))
   {
 userDetails = new
   pfUsersBean(pType,
   posName, typeCD, firstLineProduct

RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server using JNDI and Connection Pooling?

2005-08-24 Thread Allistair Crossley
Hi again,

By the way, you really ought to consider *not* using the MS drivers. jTDS at 
jtds.sourceforge.net is more performant.

Cheers, Allistair

 -Original Message-
 From: Wylie, Ian [mailto:[EMAIL PROTECTED]
 Sent: 24 August 2005 12:33
 To: Tomcat Users List
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 using JNDI and Connection Pooling?
 
 
 Hi Allistair,
 
 I just got the basic JNDI datasource working for MS SQL 
 Server with Tomcat
 5.5.
 
 I tried using the ConnectionPoolDataSource instead of the standard
 DataSource but I cannot get this working.
 
 Not sure whether I need to replace the
 res-typejavax.sql.DataSource/res-type with something else 
 in the web.xml
 file.
 
 I changed the driverclass name from the standard datasource class of
 com.microsoft.jdbc.sqlserver.SQLServerDriver - used with 
 standard datasource
 to the com.microsoft.jdbcx.sqlserver.SQLServerDataSource 
 class used by MS
 connection pooling in the 
 TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
 file.  Also added the factory for PooledConnections -
 factory=com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFact
 ory to the
 TOMCAT_HOME/conf/Catalina/localhost/webappname.xml file. 
 
 Any ideas to get the MS Connection Pooling working, or is 
 there no need in
 Tomcat 5.5  -   In aother words does Tomcat 5.5 automatically 
 used Cnnection
 Pooling with a datasource??
 
 Many thanks for your help with this.
 
 Best Regards,
 
 Ian
 
 
 -Original Message-
 From: Allistair Crossley [mailto:[EMAIL PROTECTED]
 Sent: 23 August 2005 16:05
 To: Tomcat Users List; [EMAIL PROTECTED]
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 usin g JNDI?
 
 
 Hi Wade,
 
 Can you perhaps resend the configuration files
 
 server.xml
 web.xml
 yourapp.xml
 listing of files in common/lib
 listing of files in yourapp/WEB-INF/lib
 
 Again?
 
 Cheers, Allistair.
 
  -Original Message-
  From: Wade Chandler [mailto:[EMAIL PROTECTED]
  Sent: 22 August 2005 17:58
  To: Tomcat Users List
  Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS 
 SQL Server
  usin g JNDI?
  
  
  --- Wylie, Ian [EMAIL PROTECTED] wrote:
  
   Allistair,
   
   My apologies for taking much longer than usual to
   get back to you but I had
   to finish some Java code that allowed us to upgrade
   our portal to PlumTree
   version 5.
   
   To clarify and answer your points below.
   
   1)  I have opted not to have a context.xml file in
   the META-INF directory
   but I am using the 
   TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
   file
   instead.
   
   2)  I  have ensured that the 3 MS JAR files for the
   JDBC connection exist
   only in TOMCAT_HOME/common/lib and not in my webapp
   lib.
   
   3)  I have changed the java code to use a simple
   'DataSource' instead of a
   'ConnectionPoolDataSource' connection.  See Java
   code snippet below :-
   
   Unfortunately I still get the error below :-
   
   ERROR - NamingException - Config error with JNDI
   and
   datasource.javax.naming.NamingException: Cannot
   create resource instance
   ERROR com.webconnex.cognos.PORT.OMTLreport  : Cannot
   create resource
   instance
   
   I have attached my web.xml and
   TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
   files for your perusal.
   
   
   I am of yet no further forward in solving my
   problem.
   
   Any further insight would be appreciated, as Tomcat
   5 allows me to do quite
   a few things better, not least of which is
   debugging!!
   
   
   Java Code snippet :-
   
  
  =
   
   logger.debug(Before
   InitialContext.) ;
   InitialContext ctx = new
   InitialContext();
   if (ctx == null) { 
   log(ERROR initialising
   InitialContext.) ;  
   logger.error(ERROR initialising
   InitialContext.) ;
   }
   log(Before Context.) ;
   ds = (DataSource)
   ctx.lookup(java:comp/env/jdbc/UKportalPool);
   
   log(Before initialising
   DataSource.) ;
   
   if(ds != null) {
   con = ds.getConnection();
   if (con != null) {
 
 if ((pType != null) 
   (!pType.equals()))
   {
 userDetails = new
   pfUsersBean(pType,
   posName, typeCD, firstLineProduct);
 userSessionDetails = new
   pfUserSessionBean();
 userDetails.getPrefix(con,
   userDetails);  // See if User is in database
 
   //userDetails.getPrefix(pCon,
   userDetails);  // See if User is in database
 

   ptpResponse.setSettingValue(SettingType.Portlet,
   SalesCubePrefix