Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-30 Thread Micael Padraig Og mac Grene

I use postgresql.jar, so I put that in /usr/local/java/tomcat/lib/ext/ and
/usr/local/java/j2se13/jre/lib/ext/ and /usr/local/java/j2se13/lib/ext/.
Those directories are automatically found and do not need to be specified in
CLASSPATH.


-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 2:20 PM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


To answer your question, yes I understand what a servlet's init() method is
and when it's called.   You've provided valuable information and I
basically understand it, providing jdbc setup info through init-params in
web.xml.  I'll definitely plan on looking closer at javax.jdbc - I've only
used the (as you put it) 'kiddy' jdbc stuff in the past.

However, my question is about the physical location of the jdbc driver .jar
file.  In other environments I've worked with, including the location of
the .jar in the CLASSPATH was sufficient.  With Tomcat, does one have to
copy the driver to ../common/lib?  If so, that doesn't seem like a very
good situation to be in especially in a production environment.  I tried to
modify CLASSPATH in the startup scripts to see if that'd work, but
everything went haywire after that under Win2k - *nothing* worked even
after backing out the simple change (even had to reboot to get things in
working order again).

I suspect I'm again missing/not understanding something.

Thanks again for your help...
Mark


At 10:17 AM 11/29/2001 -0800, you wrote:
Hi, Mark,

Moving on, I see.  Great!  Here is a bunch of junk to look at and maybe
learn from.  (I don't mind ending sentences prepositions with.)  First is
this little way to get a connection from a PostgreSQL driver using
DataSource.  I assume you will be using DataSource and not the kiddies
version of jdbc, i.e. you will be using the jdbc extension, I assume.  If
not, you should.  I don't want to bother talking about the kiddy version,
which is well-covered in Sun tutorials.  If I seem to talk about the kiddy
version with disdain, that is the correct impression. ///;-)

Once you have the industrial strength jdbc set up with DataSource, the
rest
should be somewhat obvious.  There is nothing really tricky or special
about
Tomcat in this regard.

What I definitely like to do is to get all the database parameters as
you
say established with start up in Tomcat, so I put it all in a StartUp
servlet that has an init() method.  Before I go on, I will stop and ask if
you know what an init() method with a servlet does?


NOTICE THAT THE jdbcURL, etc. used in the start up servlet come from the
web.xml specification that is for the start up servlet and ServletConfig,
i.e. are for init() parameters in web.xml.

Also note the resource reference in the web.xml at the bottom.  You are
beginning to get into a bit more complicated area.  You have to include
your
jar or classes for a driver just like you do any classes or jars.  Jars
are
jars and classes are classes and they all are found in the same way.  I
also
use Tomcat in the context of an application server, running in the same
JVM,
so I have not shown a lot I do in relation to JMX specifications and
MBeans
and MLET classes which pop all I show here into a JNDI context.  But, that
should not be a problem.

Please do not fail to stop and learn the DataSource and jdbc extension
stuff.  You have to get an advanced driver when you do this.  The kiddy
drivers do not work with or have DataSource implementations.  You need to
do
some scouting and reading on this, if you are not already up to speed.
When
I find out how much you know about this, then I can point you better.

Micael

Below are:

   1.  A little made up class to get a DataSource connection or Connection
object.

2.   A more developed web.xml than I have shown you before.

3.  A StartUp servlet which is fairly sophisticated.

Have fun and let me know how it goes, if you would.  I have an interest in
seeing how you progress with all this, because we all have to train people
new at things.

Micael, again

///;-)



///

public class PostgresqlConnection {
private Connection conn;
private String user;
private String password;

public Connection getConnection(String user, String password) throws
ClassNotFoundException, SQLException {
Class.forName(org.postgresql.Driver);
PostgresqlDataSource dataSource = new PostgresqlDataSource();
  conn = dataSource.getConnection(user, password);
return conn;
}
}

//

?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
http://java.sun.com/j2ee/dtds/web-app_2.2.dtd;

web-app
  servlet
   servlet-nameauthenticate/servlet-name
   servlet-classAppAuthenticateServlet/servlet-class
  /servlet

  servlet
   servlet

Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-30 Thread Micael Padraig Og mac Grene

You have to get a driver for the database you are using.  You have to get a
whole mydatabase.jar of files from them, implementing the jdbc interfaces.
Then you put those into /lib/ext/ in Tomcat and  j2ee and /jre/lib/ext/ in
j2se.  These do not need to be specified in CLASSPATH.

-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 2:20 PM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


To answer your question, yes I understand what a servlet's init() method is
and when it's called.   You've provided valuable information and I
basically understand it, providing jdbc setup info through init-params in
web.xml.  I'll definitely plan on looking closer at javax.jdbc - I've only
used the (as you put it) 'kiddy' jdbc stuff in the past.

However, my question is about the physical location of the jdbc driver .jar
file.  In other environments I've worked with, including the location of
the .jar in the CLASSPATH was sufficient.  With Tomcat, does one have to
copy the driver to ../common/lib?  If so, that doesn't seem like a very
good situation to be in especially in a production environment.  I tried to
modify CLASSPATH in the startup scripts to see if that'd work, but
everything went haywire after that under Win2k - *nothing* worked even
after backing out the simple change (even had to reboot to get things in
working order again).

I suspect I'm again missing/not understanding something.

Thanks again for your help...
Mark



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-30 Thread Micael Padraig Og mac Grene

Did you get my messages?
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 2:20 PM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


To answer your question, yes I understand what a servlet's init() method is
and when it's called.   You've provided valuable information and I
basically understand it, providing jdbc setup info through init-params in
web.xml.  I'll definitely plan on looking closer at javax.jdbc - I've only
used the (as you put it) 'kiddy' jdbc stuff in the past.

However, my question is about the physical location of the jdbc driver .jar
file.  In other environments I've worked with, including the location of
the .jar in the CLASSPATH was sufficient.  With Tomcat, does one have to
copy the driver to ../common/lib?  If so, that doesn't seem like a very
good situation to be in especially in a production environment.  I tried to
modify CLASSPATH in the startup scripts to see if that'd work, but
everything went haywire after that under Win2k - *nothing* worked even
after backing out the simple change (even had to reboot to get things in
working order again).

I suspect I'm again missing/not understanding something.

Thanks again for your help...
Mark


At 10:17 AM 11/29/2001 -0800, you wrote:
Hi, Mark,

Moving on, I see.  Great!  Here is a bunch of junk to look at and maybe
learn from.  (I don't mind ending sentences prepositions with.)  First is
this little way to get a connection from a PostgreSQL driver using
DataSource.  I assume you will be using DataSource and not the kiddies
version of jdbc, i.e. you will be using the jdbc extension, I assume.  If
not, you should.  I don't want to bother talking about the kiddy version,
which is well-covered in Sun tutorials.  If I seem to talk about the kiddy
version with disdain, that is the correct impression. ///;-)

Once you have the industrial strength jdbc set up with DataSource, the
rest
should be somewhat obvious.  There is nothing really tricky or special
about
Tomcat in this regard.

What I definitely like to do is to get all the database parameters as
you
say established with start up in Tomcat, so I put it all in a StartUp
servlet that has an init() method.  Before I go on, I will stop and ask if
you know what an init() method with a servlet does?


NOTICE THAT THE jdbcURL, etc. used in the start up servlet come from the
web.xml specification that is for the start up servlet and ServletConfig,
i.e. are for init() parameters in web.xml.

Also note the resource reference in the web.xml at the bottom.  You are
beginning to get into a bit more complicated area.  You have to include
your
jar or classes for a driver just like you do any classes or jars.  Jars
are
jars and classes are classes and they all are found in the same way.  I
also
use Tomcat in the context of an application server, running in the same
JVM,
so I have not shown a lot I do in relation to JMX specifications and
MBeans
and MLET classes which pop all I show here into a JNDI context.  But, that
should not be a problem.

Please do not fail to stop and learn the DataSource and jdbc extension
stuff.  You have to get an advanced driver when you do this.  The kiddy
drivers do not work with or have DataSource implementations.  You need to
do
some scouting and reading on this, if you are not already up to speed.
When
I find out how much you know about this, then I can point you better.

Micael

Below are:

   1.  A little made up class to get a DataSource connection or Connection
object.

2.   A more developed web.xml than I have shown you before.

3.  A StartUp servlet which is fairly sophisticated.

Have fun and let me know how it goes, if you would.  I have an interest in
seeing how you progress with all this, because we all have to train people
new at things.

Micael, again

///;-)



///

public class PostgresqlConnection {
private Connection conn;
private String user;
private String password;

public Connection getConnection(String user, String password) throws
ClassNotFoundException, SQLException {
Class.forName(org.postgresql.Driver);
PostgresqlDataSource dataSource = new PostgresqlDataSource();
  conn = dataSource.getConnection(user, password);
return conn;
}
}

//

?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
http://java.sun.com/j2ee/dtds/web-app_2.2.dtd;

web-app
  servlet
   servlet-nameauthenticate/servlet-name
   servlet-classAppAuthenticateServlet/servlet-class
  /servlet

  servlet
   servlet-nameaction/servlet-name
   servlet-classActionServlet/servlet-class
   init-param
 param-nameaction-mappings/param-name
 param-valueactions/param-value
   /init-param
  /servlet

  servlet
   servlet-namesetup

Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-30 Thread Mark

Yes, I saw your replies about the db jar files.  The company I work for
uses various databases, and it seems unusual (to me) to have to copy each
vendor's JDBC .jar files to other directories vs. being able to directly to
them in their respective production install directories (eg.
../oracle/jdbc/lib/classes12.jar).  That's a subjective opinion though.  In
any case, I moved on to JSP taglibs with Tomcat and had absolutely no
problems.

I'm ramping up for a J2EE development project and very pleased with the
progress I've made with Tomcat this week (after getting over my initial
servlet mapping problems/ignorance).

Next... I'll make my first attempt at using the Sun RI of Java Data
Objects.  Anyone used JDO in conjuction with Tomcat?  



At 09:20 AM 11/30/2001 -0800, you wrote:
Did you get my messages?
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 2:20 PM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


To answer your question, yes I understand what a servlet's init() method is
and when it's called.   You've provided valuable information and I
basically understand it, providing jdbc setup info through init-params in
web.xml.  I'll definitely plan on looking closer at javax.jdbc - I've only
used the (as you put it) 'kiddy' jdbc stuff in the past.

However, my question is about the physical location of the jdbc driver .jar
file.  In other environments I've worked with, including the location of
the .jar in the CLASSPATH was sufficient.  With Tomcat, does one have to
copy the driver to ../common/lib?  If so, that doesn't seem like a very
good situation to be in especially in a production environment.  I tried to
modify CLASSPATH in the startup scripts to see if that'd work, but
everything went haywire after that under Win2k - *nothing* worked even
after backing out the simple change (even had to reboot to get things in
working order again).

I suspect I'm again missing/not understanding something.

Thanks again for your help...
Mark


At 10:17 AM 11/29/2001 -0800, you wrote:
Hi, Mark,

Moving on, I see.  Great!  Here is a bunch of junk to look at and maybe
learn from.  (I don't mind ending sentences prepositions with.)  First is
this little way to get a connection from a PostgreSQL driver using
DataSource.  I assume you will be using DataSource and not the kiddies
version of jdbc, i.e. you will be using the jdbc extension, I assume.  If
not, you should.  I don't want to bother talking about the kiddy version,
which is well-covered in Sun tutorials.  If I seem to talk about the kiddy
version with disdain, that is the correct impression. ///;-)

Once you have the industrial strength jdbc set up with DataSource, the
rest
should be somewhat obvious.  There is nothing really tricky or special
about
Tomcat in this regard.

What I definitely like to do is to get all the database parameters as
you
say established with start up in Tomcat, so I put it all in a StartUp
servlet that has an init() method.  Before I go on, I will stop and ask if
you know what an init() method with a servlet does?


NOTICE THAT THE jdbcURL, etc. used in the start up servlet come from the
web.xml specification that is for the start up servlet and ServletConfig,
i.e. are for init() parameters in web.xml.

Also note the resource reference in the web.xml at the bottom.  You are
beginning to get into a bit more complicated area.  You have to include
your
jar or classes for a driver just like you do any classes or jars.  Jars
are
jars and classes are classes and they all are found in the same way.  I
also
use Tomcat in the context of an application server, running in the same
JVM,
so I have not shown a lot I do in relation to JMX specifications and
MBeans
and MLET classes which pop all I show here into a JNDI context.  But, that
should not be a problem.

Please do not fail to stop and learn the DataSource and jdbc extension
stuff.  You have to get an advanced driver when you do this.  The kiddy
drivers do not work with or have DataSource implementations.  You need to
do
some scouting and reading on this, if you are not already up to speed.
When
I find out how much you know about this, then I can point you better.

Micael

Below are:

   1.  A little made up class to get a DataSource connection or Connection
object.

2.   A more developed web.xml than I have shown you before.

3.  A StartUp servlet which is fairly sophisticated.

Have fun and let me know how it goes, if you would.  I have an interest in
seeing how you progress with all this, because we all have to train people
new at things.

Micael, again

///;-)



///

public class PostgresqlConnection {
private Connection conn;
private String user;
private String password;

public Connection getConnection(String user, String password) throws
ClassNotFoundException, SQLException

Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-30 Thread Micael Padraig Og mac Grene

Yah, you've moved along alright.
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Friday, November 30, 2001 10:03 AM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


Yes, I saw your replies about the db jar files.  The company I work for
uses various databases, and it seems unusual (to me) to have to copy each
vendor's JDBC .jar files to other directories vs. being able to directly to
them in their respective production install directories (eg.
../oracle/jdbc/lib/classes12.jar).  That's a subjective opinion though.  In
any case, I moved on to JSP taglibs with Tomcat and had absolutely no
problems.

I'm ramping up for a J2EE development project and very pleased with the
progress I've made with Tomcat this week (after getting over my initial
servlet mapping problems/ignorance).

Next... I'll make my first attempt at using the Sun RI of Java Data
Objects.  Anyone used JDO in conjuction with Tomcat?



At 09:20 AM 11/30/2001 -0800, you wrote:
Did you get my messages?
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 2:20 PM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


To answer your question, yes I understand what a servlet's init() method
is
and when it's called.   You've provided valuable information and I
basically understand it, providing jdbc setup info through init-params in
web.xml.  I'll definitely plan on looking closer at javax.jdbc - I've
only
used the (as you put it) 'kiddy' jdbc stuff in the past.

However, my question is about the physical location of the jdbc driver
.jar
file.  In other environments I've worked with, including the location of
the .jar in the CLASSPATH was sufficient.  With Tomcat, does one have to
copy the driver to ../common/lib?  If so, that doesn't seem like a very
good situation to be in especially in a production environment.  I tried
to
modify CLASSPATH in the startup scripts to see if that'd work, but
everything went haywire after that under Win2k - *nothing* worked even
after backing out the simple change (even had to reboot to get things in
working order again).

I suspect I'm again missing/not understanding something.

Thanks again for your help...
Mark


At 10:17 AM 11/29/2001 -0800, you wrote:
Hi, Mark,

Moving on, I see.  Great!  Here is a bunch of junk to look at and maybe
learn from.  (I don't mind ending sentences prepositions with.)  First
is
this little way to get a connection from a PostgreSQL driver using
DataSource.  I assume you will be using DataSource and not the kiddies
version of jdbc, i.e. you will be using the jdbc extension, I assume.
If
not, you should.  I don't want to bother talking about the kiddy
version,
which is well-covered in Sun tutorials.  If I seem to talk about the
kiddy
version with disdain, that is the correct impression. ///;-)

Once you have the industrial strength jdbc set up with DataSource, the
rest
should be somewhat obvious.  There is nothing really tricky or special
about
Tomcat in this regard.

What I definitely like to do is to get all the database parameters as
you
say established with start up in Tomcat, so I put it all in a StartUp
servlet that has an init() method.  Before I go on, I will stop and ask
if
you know what an init() method with a servlet does?


NOTICE THAT THE jdbcURL, etc. used in the start up servlet come from the
web.xml specification that is for the start up servlet and
ServletConfig,
i.e. are for init() parameters in web.xml.

Also note the resource reference in the web.xml at the bottom.  You are
beginning to get into a bit more complicated area.  You have to include
your
jar or classes for a driver just like you do any classes or jars.  Jars
are
jars and classes are classes and they all are found in the same way.  I
also
use Tomcat in the context of an application server, running in the same
JVM,
so I have not shown a lot I do in relation to JMX specifications and
MBeans
and MLET classes which pop all I show here into a JNDI context.  But,
that
should not be a problem.

Please do not fail to stop and learn the DataSource and jdbc extension
stuff.  You have to get an advanced driver when you do this.  The kiddy
drivers do not work with or have DataSource implementations.  You need
to
do
some scouting and reading on this, if you are not already up to speed.
When
I find out how much you know about this, then I can point you better.

Micael

Below are:

   1.  A little made up class to get a DataSource connection or
Connection
object.

2.   A more developed web.xml than I have shown you before.

3.  A StartUp servlet which is fairly sophisticated.

Have fun and let me know how it goes, if you would.  I have an interest
in
seeing how you progress with all this, because we all have to train
people
new at things.

Micael, again

Tomcat 4.0/JDBC driver configuration?

2001-11-29 Thread Mark

Can someone point me in the right direction or provide an example of
configuring an application to use JDBC under Tomcat 4.0?  I was able to use
both thin and OCI Oracle JDCB drover connections by copying the
classes12.zip to $CATALINA_HOME/common/lib directory and renaming it to
classes12.jar, but that's not a good long term solution.  I found having
the driver in the CLASSPATH doesn't work.

I suspect web.xml and/or server.xml is the place to configure the
deployment details.  Any examples or references to examples would be
greatly appreciated.

Mark


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Tomcat 4.0/JDBC driver configuration?

2001-11-29 Thread David Smith

Take a look at the JNDI howto in the TC 4 web site.  It does a reasonably 
good job of describing how to set things up.

For the location of classes12.jar, there are three place it could be placed:
WEB-INF/lib of your web app for use by that app only
$CATALINA_BASE/lib for use by all apps, but not TC 4
$CATALINA_BASE/common/lib for use by all apps and TC 4

Of course wherever you put the jar, you'll have to bounce the service to have 
it pick up the jar in the new location.  CLASSPATH is ignored in TC 4 because 
it caused a lot of headaches in previous versions of tomcat.

--David

On Thursday 29 November 2001 12:01 pm, you wrote:
 Can someone point me in the right direction or provide an example of
 configuring an application to use JDBC under Tomcat 4.0?  I was able to use
 both thin and OCI Oracle JDCB drover connections by copying the
 classes12.zip to $CATALINA_HOME/common/lib directory and renaming it to
 classes12.jar, but that's not a good long term solution.  I found having
 the driver in the CLASSPATH doesn't work.

 I suspect web.xml and/or server.xml is the place to configure the
 deployment details.  Any examples or references to examples would be
 greatly appreciated.

 Mark


 --
 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]




OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-29 Thread Micael Padraig Og mac Grene
-INF/tlds/security.tld/taglib-location
/taglib

taglib
taglib-uridatabase/taglib-uri
taglib-location/WEB-INF/tlds/database.tld/taglib-location
/taglib

taglib
taglib-urihtml/taglib-uri
taglib-location/WEB-INF/tlds/html.tld/taglib-location
/taglib

taglib
taglib-urilogic/taglib-uri
taglib-location/WEB-INF/tlds/logic.tld/taglib-location
/taglib

taglib
taglib-uridom/taglib-uri
taglib-location/WEB-INF/tlds/dom.tld/taglib-location
/taglib

taglib
taglib-urixslt/taglib-uri
taglib-location/WEB-INF/tlds/xslt.tld/taglib-location
/taglib

taglib
taglib-uriregions/taglib-uri
taglib-location/WEB-INF/tlds/regions.tld/taglib-location
/taglib

taglib
taglib-urixpath/taglib-uri
taglib-location/WEB-INF/tlds/xpath.tld/taglib-location
/taglib

taglib
taglib-uritokens/taglib-uri
taglib-location/WEB-INF/tlds/tokens.tld/taglib-location
/taglib

resource-ref
 descriptionPrimary database/description
  res-ref-namePostgresDS/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authCONTAINER/res-auth
 /resource-ref

 security-constraint
  web-resource-collection
   web-resource-nameCredit Card Page/web-resource-name
   url-pattern/WEB-INF/jsp/createAccount/content.jsp/url-pattern
  /web-resource-collection
  user-data-constraint
   transport-guaranteeCONFIDENTIAL/transport-guarantee
  /user-data-constraint
 /security-constraint

/web-app



SETUP SERVLET
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.sql.SQLException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import beans.app.User;
import beans.app.Users;
import beans.jdbc.DbConnectionPool;

public class SetupServlet extends HttpServlet implements
beans.app.Constants, tags.jdbc.Constants {
   private DbConnectionPool pool;

   public void init(ServletConfig config) throws ServletException{
  super.init(config);

  ServletContext ctx = config.getServletContext();
  createDbConnectionPool(config, ctx);

  try {
 ctx.setAttribute(USERS_KEY, loadUsers(ctx));
  } catch(SQLException ex) {
 throw new ServletException(ex);
  }
   }

   public void destroy() {
  ServletContext ctx = getServletConfig().getServletContext();
  ctx.removeAttribute(DBPOOL_KEY);
  ctx.removeAttribute(USERS_KEY);

  pool.shutdown();
  pool = null;
  super.destroy();
   }

   private void createDbConnectionPool(ServletConfig config, ServletContext
ctx) {
  pool = new DbConnectionPool(
  config.getInitParameter(jdbcDriver),
  config.getInitParameter(jdbcURL),
  config.getInitParameter(jdbcUser),
  config.getInitParameter(jdbcPwd));
  ctx.setAttribute(DBPOOL_KEY, pool);
   }

   private Users loadUsers(ServletContext ctx) throws SQLException {
  Connection conn = null;

  if(pool != null) {
 try {
// wait for a maximum of 10 seconds for a connection
// if pool is full
   conn = (Connection)pool.getConnection(1);
 } catch(Exception ex) {
throw new SQLException(ex.getMessage());
 }
 Statement stmt = conn.createStatement();
 ResultSet rs = stmt.executeQuery(SELECT * FROM USERS);
 Users users = new Users(rs);

 pool.recycleConnection(conn);
 return users;
  }
  return null;
   }
}


-Original Message-
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 8:58 AM
Subject: Tomcat 4.0/JDBC driver configuration?


Can someone point me in the right direction or provide an example of
configuring an application to use JDBC under Tomcat 4.0?  I was able to use
both thin and OCI Oracle JDCB drover connections by copying the
classes12.zip to $CATALINA_HOME/common/lib directory and renaming it to
classes12.jar, but that's not a good long term solution.  I found having
the driver in the CLASSPATH doesn't work.

I suspect web.xml and/or server.xml is the place to configure the
deployment details.  Any examples or references to examples would be
greatly appreciated.

Mark


--
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: Tomcat 4.0/JDBC driver configuration?

2001-11-29 Thread Micael Padraig Og mac Grene

You probably already figured out from what I sent that kiddy stuff is in
java.sql.* but grownups are in javax.sql.*.  ///;-)


-Original Message-
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 8:58 AM
Subject: Tomcat 4.0/JDBC driver configuration?


Can someone point me in the right direction or provide an example of
configuring an application to use JDBC under Tomcat 4.0?  I was able to use
both thin and OCI Oracle JDCB drover connections by copying the
classes12.zip to $CATALINA_HOME/common/lib directory and renaming it to
classes12.jar, but that's not a good long term solution.  I found having
the driver in the CLASSPATH doesn't work.

I suspect web.xml and/or server.xml is the place to configure the
deployment details.  Any examples or references to examples would be
greatly appreciated.

Mark


--
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: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-29 Thread Mark
, November 29, 2001 8:58 AM
Subject: Tomcat 4.0/JDBC driver configuration?


Can someone point me in the right direction or provide an example of
configuring an application to use JDBC under Tomcat 4.0?  I was able to use
both thin and OCI Oracle JDCB drover connections by copying the
classes12.zip to $CATALINA_HOME/common/lib directory and renaming it to
classes12.jar, but that's not a good long term solution.  I found having
the driver in the CLASSPATH doesn't work.

I suspect web.xml and/or server.xml is the place to configure the
deployment details.  Any examples or references to examples would be
greatly appreciated.

Mark


--
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]