Tomcat jndi settings...?????
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   New_User
Posted On:   Tuesday, September 24, 2002 02:12 AM

hello, i installed tomcat4.0.4 version on win2k, with jdk1.3.1. Can any body throw light on how to get database connection from my Oracle database using thin driver, i heared about tomcat's connection pooling using tyrex packge so please help me soon in giving either idea or code to have connection pooling using tomcat tyrex package. ofcourse i have a code for pooling but i have struck up with the content in server.xml and web.xml. here is my pool class. public class Pool { public static Connection getConnection() { Connection conn = null; try {   More>>

			



hello,

i installed tomcat4.0.4 version on win2k,
with jdk1.3.1. Can any body throw light on
how to get database connection from my Oracle
database using thin driver, i heared about
tomcat's connection pooling using tyrex packge
so please help me soon in giving either idea
or code to have connection pooling using tomcat
tyrex package.
ofcourse i have a code for pooling but
i have struck up with the content in server.xml
and web.xml.
here is my pool class.
public class Pool
{
public static Connection getConnection()
{
Connection conn = null;
try
{
Context ctx = (Context) new InitialContext().lookup("java:comp/env");
conn = ((DataSource) ctx.lookup("jdbc/oracleDB")).getConnection();
}
catch (Exception e)
{
e.printStackTrace(System.err);
}
return conn;
}
}

and all the other servlets using this connection class to
get connection as
con = Pool.getConnection();
and my web.xml content is :
--------------------------



Resource reference to java.sql.Connection
factory defined in server.xml

jdbc/oracleDB
javax.sql.DataSource
Container


-----------------------
and my server.xml is :














port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="60000"/>










port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>



















prefix="catalina_log." suffix=".txt"
timestamp="true"/>





















directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common"/>



directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>




















driverClassName
oracle.jdbc.driver.OracleDriver



driverName
jdbc:oracle:thin:@oracle:1521:ORCL




















user sa
password
driverClassName org.hsql.jdbcDriver
driverName jdbc:HypersonicSQL:database





mail.smtp.host
localhost

















port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true" appBase="webapps"
acceptCount="10" debug="0"/>



name="Apache" debug="0">



prefix="apache_log." suffix=".txt"
timestamp="true"/>









--------------------------------------------

please help me if any body did in different possible way
or atleast correct me my xml files.

very thanx





   <<Less

Re: Tomcat jndi settings...?????

Posted By:   Jeff_Hubbach  
Posted On:   Wednesday, September 25, 2002 10:32 AM

I would definitely use the ConnectionPooler that comes with Tomcat. Here's how we use it for PostgreSQL. The only changes you'd need to make would be the URL and driver name.




type="javax.sql.DataSource" description="Database"/>


factory
org.apache.commons.dbcp.BasicDataSourceFactory


username
foo


password
foo


driverClassName
org.postgresql.Driver


url
jdbc:postgresql://localhost/foo


maxActive
20


maxIdle
10


maxWait
-1


About | Sitemap | Contact