How to create Connection pool in Tomcat 5

present i am developing one web site in that i am using tomcat 5.
i am trying to establish connection pooling in tomcat,i am facing some problems..
tomcat throws the following exception ie.,
cannot create JDBC Driver class for connect URL null.
my code lik this
i configured the web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>sqlserver</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
my server.xml
<?xml version='1.0' encoding='utf-8'?>
<Server>
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
<Resource auth="Container" name="sqlserver" type="javax.sql.DataSource"/>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>password</name>
<value>sudha</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
<parameter>
<name>username</name>
<value>sudha</value>
</parameter>
</ResourceParams>
<ResourceParams name="sqlserver">
<parameter>
<name>url</name>
<value>jdbc:odbc:SQL</value>
</parameter>
<parameter>
<name>validationQuery</name>
<value>select * from employee</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>4</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>8</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>sun.jdbc.odbc.JdbcOdbcDriver</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>username</name>
<value>kpi</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.naming.factory.DbcpDataSourceFactory</value>
</parameter>
<parameter>
<name>password</name>
<value>kpi</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<Service name="Catalina">
<Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="8080" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
</Connector>
<Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
</Connector>
<Engine defaultHost="localhost" name="Catalina">
<Host appBase="webapps" name="localhost">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
</Host>
<Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
</Engine>
</Service>
</Server>
and i studied the the tomcat documentation in that tomcat mentioned
The configuration properties for Tomcat's standard data source resource factory (org.apache.naming.factory.DbcpDataSourceFactory) are as follows:
driverClassName - Fully qualified Java class name of the JDBC driver to be used.
maxActive - The maximum number of active instances that can be allocated from this pool at the same time.
maxIdle - The maximum number of connections that can sit idle in this pool at the same time.
maxWait - The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception.
password - Database password to be passed to our JDBC driver.
url - Connection URL to be passed to our JDBC driver. (For backwards compatibility, the property driverName is also recognized.)
user - Database username to be passed to our JDBC driver.
validationQuery - SQL query that can be used by the pool to validate connections before they are returned to the application. If specified, this query MUST be an SQL SELECT statement that returns at least one row.
how to configure server.xml file
and how to get the org.apache.naming.factory.DbcpDataSourceFactory
please help me...this module is very very urgen to me..

I spent many hours when i first implemented connection pooling trying to put it together. The information is scattered and the config has changed slightly from 5.0 to 5.5 etc. This is how I got it working in 5.5.17:
* server.xml seems to be a wrong place for the pool configuration if you consider it to be an application specific thing. It might be a better idea to put it into C:\tomcat55\conf\Catalina\localhost\ConfigFileForYourWeapp.xml as follows:
<Context path="/ClientLink" docBase="C:\eclipseWorkspace\PortfolioUI3\WebRoot">
      <Resource name="jdbc/testportfolios" auth="Container"
                     type="javax.sql.DataSource"
                     factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
                     username="****" password="******"
                     driverClassName="com.mysql.jdbc.Driver"
                     url="jdbc:mysql://192.168.0.101:3306/testportfolios?user=***********&password=***********&useUnicode=true&characterSet=swedish"
                     maxWait="10000" maxActive="30" maxIdle="10" removeAbandoned="true"
                     removeAbandonedTimeout="60" logAbandoned="true" testWhileIdle="true"
                     minEvictableIdleTimeMillis="4000"
                     timeBetweenEvictionRunsMillis="60000" validationQuery="SELECT '1'" />
      </Context>* Then add the following snippet into web.xml in your webapp directory:
<resource-ref>
                <description>Database pool defined in ClientLink.xml</description>
                <res-ref-name>jdbc/testportfolios</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
           </resource-ref>* Next put the jdbc-driver jar in a place where tomcat can find it. That is common\lib. Note that the shared/lib does not work.
* Get connections in java as follows:
                try {
                     Context initCtx = new InitialContext();
                     DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/testportfolios");
                     this.connection = ds.getConnection();
                } catch (NamingException e) {
                     throw new RuntimeException("Java naming exception when getting connection from tomcat pool: " + e.getMessage());
                }I hope that this helps you to save the time I lost figuring this out!
Message was edited by:
Tomppu

Similar Messages

  • How to create connection pooling in Tomcat 5.0

    present i am developing one web site in that i am using tomcat 5.0
    i am trying to establish connection pooling in tomcat,i am facing some problems..
    tomcat throws the following exception ie.,
    cannot create JDBC Driver class for connect URL null.
    my code lik this
    i configured the web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app>
    <resource-ref>
    <description>Oracle Datasource example</description>
    <res-ref-name>sqlserver</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    my server.xml
    <?xml version='1.0' encoding='utf-8'?>
    <Server>
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
    <Resource auth="Container" name="sqlserver" type="javax.sql.DataSource"/>
    <ResourceParams name="UserDatabase">
    <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>sudha</value>
    </parameter>
    <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>sudha</value>
    </parameter>
    </ResourceParams>
    <ResourceParams name="sqlserver">
    <parameter>
    <name>url</name>
    <value>jdbc:odbc:SQL</value>
    </parameter>
    <parameter>
    <name>validationQuery</name>
    <value>select * from employee</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>4</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>8</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>sun.jdbc.odbc.JdbcOdbcDriver</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>kpi</value>
    </parameter>
    <parameter>
    <name>factory</name>
    <value>org.apache.naming.factory.DbcpDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>kpi</value>
    </parameter>
    </ResourceParams>
    </GlobalNamingResources>
    <Service name="Catalina">
    <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="8080" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
    </Connector>
    <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina">
    <Host appBase="webapps" name="localhost">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
    </Host>
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
    </Engine>
    </Service>
    </Server>
    and i studied the the tomcat documentation in that tomcat mentioned
    The configuration properties for Tomcat's standard data source resource factory (org.apache.naming.factory.DbcpDataSourceFactory) are as follows:
    driverClassName - Fully qualified Java class name of the JDBC driver to be used.
    maxActive - The maximum number of active instances that can be allocated from this pool at the same time.
    maxIdle - The maximum number of connections that can sit idle in this pool at the same time.
    maxWait - The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception.
    password - Database password to be passed to our JDBC driver.
    url - Connection URL to be passed to our JDBC driver. (For backwards compatibility, the property driverName is also recognized.)
    user - Database username to be passed to our JDBC driver.
    validationQuery - SQL query that can be used by the pool to validate connections before they are returned to the application. If specified, this query MUST be an SQL SELECT statement that returns at least one row.
    how to configure server.xml file
    and how to get the org.apache.naming.factory.DbcpDataSourceFactory
    please help me...this module is very very urgen to me..

    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

  • How to configure connection pooling in tomcat?

    how to configure connection pooling in tomcat and how to use the connection pooling in the jsp and servlets?

    thanks for the reply, i have configured the connection pool settings in the tomcat.
    I created a class with static method, which will return the connection object.
    whenever i need the connection object, iam invoking the static method, once its usage is over iam closing thew connection..
    is it the right way of using the connection object in the web application.

  • How dynamically create connection pool and Datasource

    Hi
    How I can dynamically create a connection pool and Data source in Oracle 10g Application server. In our J2EE application the user will be login with db user name, password and database name. I want to create connection pool and data source on the fly while login the user with database name. I our application we have access approximate 80 Databases. so my approach is given bellow
    1) Planning to create 80 connection pools and 80 Data sources so when user logs in while selecting the db name i will call the appropriate data source and create the DB connection. Is there any limitation to create number of data sources in oracle app server?
    2) Create DB connection with out using connection pool and data source. But i am not prefer this approach coz we need to handle some transaction in our application.
    Kindly throw some light on managing connection pool programmatically or in application run time.
    I would really appreciate if any one can provide any links or any inormation on this issue.
    Thanks in advance.

    Kindly let me know is there any drawbacks to create 80 Data Sources to connect 80 database in Oracle 10G App server and each data sources should have one connection pool. so i need to create 80 connection pool. Please let me know is this right approach or any work around to create Data source on fly for each request for corresponding database.

  • How To create Connection Pooling in Oracle 10.1.2.0 Application Server

    Hi,
    How to create Conncetion Pooling in Oracle 10g Application Server. I am using 10.1.2.0 version.
    Thanx
    Dhans

    Hi,
    How about these tutorials?
    http://www.oracle.com/technology/tech/java/newsletter/articles/oc4j_data_sources/oc4j_ds.htm
    http://www.oracle.com/technology/products/jdev/tips/duff/mysql_and_oc4j3.html

  • Create connection poolin in tomcat

    Hi,
    Can any one tell me how to create connection pooling in tomcat server?
    is it possible to create connection pooling in tomcat?
    thanks,
    prabhu selvakumar.

    can u send that URL bradmallan?Good grief. What size spoon do you need?
    http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
    ~

  • How to use Connection pool in Reports

    Dear All,
    Please help me How to create Connection pool for Reports and How to use in Reports.
    Present i am using the report by passing parameter as P_JDBCPDS=username/password@databaseName. I thought this will not manage the coonection pool.
    For all reports and every time i am passing userName/password, how to avoid this. Please help me.
    1. How to create Connection pool for Report Server
    2. How to use that Connection pool in the Reports.
    Please help me.
    With Regards,
    Srinivas.

    Until now, I have not worked unfortunately with a connection pool, but, I have found a documentation about the Creating an Internal Connection Pool.
    http://download-east.oracle.com/docs/cd/B25221_04/web.1013/b13593/cpdef.htm

  • Creating Connection Pools/ Connection Pool does not exist error

    Hi everyone -
    I have a question about when/how weblogic creates connections pools.
    Here is the scenario. Sometimes when our weblogic server starts, our
    oracle database is not available. Therefor, weblogic can't create the
    connection pool. However, after oracle comes weblogic up, weblogic
    could create the connection pool, but it doesn't appear to be smart
    enough to do this. Is there a way to ask weblogic to attempt to
    recreate a connection pool?
    We've noticed this behavior on weblogic 6.0 sp2.
    Thanks,
    Scott

    If you define the pool with an initial size of zero, you should be OK. The
    server is currently a little severe with a pool when the server cannot
    create the pool with it's initial capacity, the pool isn't created. The server
    could create it later, if told to via the console or via the admin command line,
    or via the dynamic pool API, but init=0 is easiest.
    Joe
    Scott Gilpin wrote:
    Hi everyone -
    I have a question about when/how weblogic creates connections pools.
    Here is the scenario. Sometimes when our weblogic server starts, our
    oracle database is not available. Therefor, weblogic can't create the
    connection pool. However, after oracle comes weblogic up, weblogic
    could create the connection pool, but it doesn't appear to be smart
    enough to do this. Is there a way to ask weblogic to attempt to
    recreate a connection pool?
    We've noticed this behavior on weblogic 6.0 sp2.
    Thanks,
    Scott

  • Connection pooling  in Tomcat

    Hello all,
    I've been using tomcat 5.0.27 and for quite sometime now using the connection pooling on tomcat as well.
    I configure DataSource(no.of connections,username, password etc) by logging into tomcat admin console.
    But what I've seen is it adds datasource configuration data into server.xml - including the username and password to the database(which will be supplied to the driver by the container when creating a connection). But I don't want the username and password to be present in the xml file (i.e. in clear text format). Is it possible to somehow give the password and the username when requesting for a connection i.e. datasource.getConnection and not while configuring the pool and still get it working?
    Please guide me.
    Thanks,

    Oh yeah. I've already tried it. It always seems to
    get the connection with the credentials that I gave
    while configuring the datasource. Whatever password I
    pass in the call to getConnection - it is being
    ignored.Do you have one already set in the server.xml? If so, try removing it (and restarting the server).
    But an implication - the server might just decide to
    have say x connections in the pool on startup. So if
    you havent given the uname/password for the
    database(when you configured the datasource) and give
    the credentials only when getConnection is called in
    your code - how will the server have those x
    connections in the pool on startup?Probably won't It may wait to store the connections to the pool until x number of calls to the getConnection method are made (like a lazy initialization). But I don't know, just getting around to testing now.
    I have people telling me that having uname/password to
    the database in server.xml doesn't augur well for the
    security of data in the db :(It could be true, but
    1) The only people to see the server.xml are those who work on the server. The server.xml (or better the context.xml if you can avoid editing the server.xml altogether) is not accessable from the web.
    2) My strategy was always to create many different levels of access to any particular database. Some with Read Only access and limited table viewability, and then progressively higher access. You give the server.xml only the access they absolutely need. IE, if they are just retrieving data from a couple tables, make a read-only user with the ability to see only those tables...
    Don't take my word for it though. I have never really tried to do the whole ultra-secure thing, my apps are not important.

  • How to retain connection pool resource while exporting the application war

    hello,
    lately i have figured out how to use connection pooling. now i have another issue.
    i have to export the application war file to a remote server for deployment. i cant configure the server.xml file there due to restrictions. Now is there any way that i can retain the connection pooling with all JNDI resources while exporting the war file. what all things would i have to do. i am using tomcat 4.1 and the remote server too have the same appliaction server running.
    is this possible?
    thanks in advance

    Hi,
    you might have the problem in creating WAR files.
    lease check that first.
    thanks,
    nvseenuNo, the problem is that you shouldn't be modifying the server.xml
    The proper, portable way to do it is to create a context.xml file and put it in the META-INF directory of your WAR file. This contains your Resource definition and JDBC connection parameters. Everything's portable that way.
    I know this works on Tomcat 5.x.
    It can also work with Tomcat 4.1.x, but the way I've done it is to put the context.xml into a file whose name matches my WAR file (e.g, foo.war and foo.xml), placing both in the /webapps directory. Tomcat 4.1.x picks it up that way.
    It would be worth an experiment to see if Tomcat 4.1.x picks up the context from /META-INF, because that way your WAR file is 100% portable.
    This is precisely the reason why I advise people not to edit the server.xml. You don't always have the option to do so.
    %

  • Database connection Pooling in TOMCAT

    I am trying Database connection Pooling in TOMCAT
    I am getting the following error
    org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
    My Web.xml in $CATALINA_HOME\conf\web.xml
    <resource-ref>
    <res-ref-name>WMSPREF</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    and my server.xml in
    $CATALINA_HOME\conf\server.xml
    <ResourceParams name="WMSPREF">
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>oracle.jdbc.driver.OracleDriver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:oracle:thin:@10.94.100.148:1521:WMSPREF</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>wmsmigrate</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>abnwms</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>20</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>10</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>-1</value>
    </parameter>
    </ResourceParams>
    And my database.jsp : code
         Context ctx = new InitialContext();
         Context envContext = (Context)ctx.lookup("java:comp/env");
         DataSource ds = (DataSource)envContext.lookup("WMSPREF");
         conn = ds.getConnection();

    What version of Tomcat do you have? 4? 5? 5.5?
    Have you defined a Resource entry in server.xml as well as the ResourceParams?
    I have never had any luck configuring a datasource in the server.xml file.
    What HAS worked for me is putting the config into a myWebApp.xml file.
    My web context is "myWebApp"
    The name of the file is "myWebApp.xml"
    For Tomcat4 for this goes in the webapps directory
    For Tomcat5 this goes in the [TOMCAT_HOME]/conf/Catalina/localhost directory
    <?xml version='1.0' encoding='utf-8'?>
    <Context path="/myWebApp" docBase="myWebApp" debug="1" reloadable="true" crossContext="true" >
    <Resource name="WMSPREF" auth="Container"
                  type="javax.sql.DataSource">
    </Resource>
    <ResourceParams name="WMSPREF">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>oracle.jdbc.driver.OracleDriver</value>
    </parameter>
    <parameter>
      <name>url</name>
      <value>jdbc:oracle:thin:@10.94.100.148:1521:WMSPREF</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>wmsmigrate</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>abnwms</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>20</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>10</value>
    </parameter>
    <parameter>
      <name>maxWait</name>
      <value>-1</value>
    </parameter>
    </ResourceParams>
    </Context>Cheers,
    evnafets

  • Problem with creating Connection pool and JNDI, driver is not detected

    Hi,
    I have an issue with creating Connection Pool and JNDI.
    I'm using:
    - JDK 1.6
    - OS: Linux(ubuntu 8.10)
    - Netbeans IDE 6.5.1
    - Java EE 5.0
    - Apache Tomcat 6.0.18 Its lib directory contains all necessary jar files for Oracle database driver
    - Oracle 11g Enterprise
    My problem is that the Oracle database driver is not detected when I want to create a pool (it works pretty well and is detected without any problem when I create ordinary connection by DriverManager)
    Therefore after running:
    InitialContext ic = new InitialContext();
    Context context = (Context)ic.lookup("java:comp/env");
    DataSource dataSource = (DataSource)context.lookup("jdbc/oracle11g");
    Connection connection = dataSource.getConnection();and right after dataSource.getConnection() I have the following exception:
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at servlets.Servlet1.doPost(Servlet1.java:47)
    at servlets.Servlet1.doGet(Servlet1.java:29)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
    ... 17 more
    My application context file (context.xml) is:
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/WebApplication3">
      <Resource auth="Container"
                      driverClassName="oracle.jdbc.OracleDriver"
                      maxActive="8"
                      maxIdle="4"
                      name="jdbc/oracle11g"
                      username="scott"
                      password="tiger"
                      type="javax.sql.DataSource"
                      url="jdbc:oracle:thin:@localhost:1521:database01" />
    </Context>and my web.xml is:
        <resource-ref>
            <description>Oracle Datasource example</description>
            <res-ref-name>jdbc/oracle11g</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>
    ...I found similar threads in different forums including sun, such as
    http://forums.sun.com/thread.jspa?threadID=567630&start=0&tstart=0
    http://forums.sun.com/thread.jspa?threadID=639243&tstart=0
    http://forums.sun.com/thread.jspa?threadID=5312178&tstart=0
    , but no solution.
    As many suggest, I also tried to put context directly in the server.xml (instead of my application context) and referencing it by <ResourceLink /> inside my application context but it didn't work and instead it gave me the following message:
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '   ' for connect URL 'null'
    Has anyone succeeded in creating a connection pool with JNDI by using Tomcat 6 or higher ? If yes, could kindly explain about the applied method.
    Regards,

    Hello again,
    Finally I managed to run my application also with Tomcat 6.0.18. There was only two lines that had to be modified
    in the context.xml file (the context of my application project and not server's)
    Instead of writing
    <Context antiJARLocking="true" path="/WebApplication2">
        type="javax.sql.DataSource"
        factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
    </Context>we had to write:
    <Context antiJARLocking="true" path="/WebApplication2">
        type="oracle.jdbc.pool.OracleDataSource"
        factory="oracle.jdbc.pool.OracleDataSourceFactory"
    </Context>- No modification was needed to be done at server level (niether server.xml nor server context.xml)
    - I just added the ojdbc6.jar in $CATALINA_HOME/lib (I didn't even need to add it in WEB-INF/lib of my project)
    - The servlet used to do the test was the same that I presented in my precedent post.
    For those who have encountered my problem and are interested in the format of the web.xml and context.xml
    with Tomcat 6.0, you can find them below:
    Oracle server: Oracle 11g Enterprise
    Tomcat server version: 6.0.18
    Oracle driver: ojdbc.jar
    IDE: Netbeans 6.5.1
    The context.xml file of the web application
    <?xml version="1.0" encoding="UTF-8"?>
    <Context antiJARLocking="true" path="/WebApplication2">
        <Resource name="jdbc/oracle11g"
                  type="oracle.jdbc.pool.OracleDataSource"
                  factory="oracle.jdbc.pool.OracleDataSourceFactory"
                  url="jdbc:oracle:thin:@localhost:1521:database01"
                  driverClassName="oracle.jdbc.OracleDriver"
                  userName="scott"
                  password="tiger"
                  auth="Container"
                  maxActive="100"
                  maxIdle="30"
                  maxWait="10000"
                  logAbandoned="true"
                  removeAbandoned="true"
                  removeAbandonedTimeout="60" />
    </Context>The web.xml of my web application
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <resource-ref>
            <description>Oracle Database 11g DataSource</description>
            <res-type>oracle.jdbc.pool.OracleDataSource</res-type>
            <res-auth>Container</res-auth>
            <res-ref-name>jdbc/oracle11g</res-ref-name>
        </resource-ref>
        <servlet>
            <servlet-name>Servlet1</servlet-name>
            <servlet-class>servlets.Servlet1</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>Servlet1</servlet-name>
            <url-pattern>/Servlet1</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    </web-app>Ok, now I'm happy as the original problem is completely solved
    Regards

  • Connection Pooling in Tomcat 4.1.18

    Hi,
    Can anyone point me to a decent resource on how to implement Oracle connection pooling in Tomcat? I'm using the UltraSearch API's for an application and cannot get it to work correctly with the DBCP implementation that I currently use.
    Many thanks,
    Mark.

    Mark,
    What kind of Oracle Connection pooling are your refering to? Are you talking about BC4J connection pooling?

  • How to use Connection Pool in ADF ear file creaion from jDev 10.1.3

    Hi,
    We are developing big application in ADF with 10 different modules. We are creating ear file with data source setting.
    How to use connection pool while creating ear file from jDev. Connection pool is alreday created in Application Server 10g.
    What all the setting we need do to make use of connection pool while creating ear file jDev.
    Thanks

    User,
    If you are using ADF Business Components, you can right-click each application module, select "configurations" and edit the configuration you are using. On the initial page of the configuration dialog, you can specify to use either a JDBC URL or a Datasource - you just need to choose Datasource and then provide the name by which to access it.
    John

  • Cant create connection Pool for MS SQL Server 2000 with Microsoft Driver

    i am using bea weblogic server 6.1, i cant create connection pool while using MS
    SQL Server 2000. i have installed JDBC Driver SAP1 from microsoft website. when
    i give the following class name for JDBC driver and the connection url and click
    apply while selecting the available server, a number of exception appears in default
    server (that is the connection pool cannot be created..... cannot load the driver
    class).
    URL= jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=MyDB
    Driver= com.microsoft.jdbc.sqlserver.SQLServerDriver
    when i use the above setting in a JDBC simple application in Jbuilder
    7.0 the application runs successfully and fetches the data deom MS SQL database
    but in at Bea connection Pool is not created with these settings. i do give appropriate
    username and password in properties field in connection pool. Thankx for any help!

    khabbab wrote:
    That was the original code part from "startweblogic" :
    :runWebLogic
    echo on
    set PATH=.\bin;%PATH%
    set CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;
    echo off
    and i changed it to :
    :runWebLogic
    echo on
    set PATH=.\bin;%PATH%
    set CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;D:\Program Files\Microsoft
    SQL Server 2000 Driver for JDBC\lib\msbase.jar;D:\Program Files\Microsoft SQL
    Server 2000 Driver for JDBC\lib\msutil.jar;D:\Program Files\Microsoft SQL Server
    2000 Driver for JDBC\lib\mssqlserver.jar;I suggest moving or copying the three ms driver jars to a directory that has no blanks
    in it so the classpath doesn't have blanks in it. Ie:
    go to the "D:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib"
    directory and do this:
    mkdir D:\microsoft_jdbc_driver
    cp *.jar D:\microsoft_jdbc_driver
    Then make the classpath include D:\microsoft_jdbc_driver\msbase.jar etc.
    Joe
    >
    >
    echo off
    when i save and run the bat file, server appears then disappears.
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    The class path which is echoed at server startup does not include thepaths to
    driver jar files. when i edited the "startweblogic.bat" file and includedthe
    driver class paths to jar files, now the server doesnot even run. tellme what
    to do now???Show me what change you made to the startweblogic file.
    Joe
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    kindly tell me how can i check that the class paths for driver jarfiles are included
    in that string? thanks. also tell me can not i use the jdriver forsql server
    2000?.The startup script will echo what it's doing, including printing out
    the classpath
    it will use. Yes you can use the jDriver for MS SQL2000. It is sufficient
    for
    basic JDBC, but the MS drivfer is preferable in some ways.
    Joe
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    i am using bea weblogic server 6.1, i cant create connection
    pool
    while
    using MS
    SQL Server 2000. i have installed JDBC Driver SAP1 from microsoft
    website.
    when
    i give the following class name for JDBC driver and the connectionurl and click
    apply while selecting the available server, a number of exception
    appears
    in default
    server (that is the connection pool cannot be created..... cannot
    load
    the driver
    class).The server startup script creates a string that will become the
    classpath
    for the server.
    This string is part of the java call to start the server with a-classpath
    argument. You need to
    make sure the MS driver jars are part of that classpath string.
    Joe
    URL= jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=MyDB
    Driver= com.microsoft.jdbc.sqlserver.SQLServerDriver
    when i use the above setting in a JDBC simple applicationin Jbuilder
    7.0 the application runs successfully and fetches the data deom
    MS
    SQL database
    but in at Bea connection Pool is not created with these settings.
    i
    do give appropriate
    username and password in properties field in connection pool.
    Thankx
    for any help!
    khabbab wrote:
    The class path which is echoed at server startup does not include thepaths to
    driver jar files. when i edited the "startweblogic.bat" file and includedthe
    driver class paths to jar files, now the server doesnot even run. tellme what
    to do now???
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    kindly tell me how can i check that the class paths for driver jarfiles are included
    in that string? thanks. also tell me can not i use the jdriver forsql server
    2000?.The startup script will echo what it's doing, including printing out
    the classpath
    it will use. Yes you can use the jDriver for MS SQL2000. It is sufficient
    for
    basic JDBC, but the MS drivfer is preferable in some ways.
    Joe
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    i am using bea weblogic server 6.1, i cant create connection
    pool
    while
    using MS
    SQL Server 2000. i have installed JDBC Driver SAP1 from microsoft
    website.
    when
    i give the following class name for JDBC driver and the connectionurl and click
    apply while selecting the available server, a number of exception
    appears
    in default
    server (that is the connection pool cannot be created..... cannot
    load
    the driver
    class).The server startup script creates a string that will become the
    classpath
    for the server.
    This string is part of the java call to start the server with a-classpath
    argument. You need to
    make sure the MS driver jars are part of that classpath string.
    Joe
    URL= jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=MyDB
    Driver= com.microsoft.jdbc.sqlserver.SQLServerDriver
    when i use the above setting in a JDBC simple applicationin Jbuilder
    7.0 the application runs successfully and fetches the data deom
    MS
    SQL database
    but in at Bea connection Pool is not created with these settings.
    i
    do give appropriate
    username and password in properties field in connection pool.
    Thankx
    for any help!

Maybe you are looking for

  • My palm m105's touch screen doesn't work properly after a sync.

    I dug out my old m105, put new batteries in and start it. On first launch it auto runs the alignment tool, and after touching all the points it goes to the main screen and works fine. No problem till here. Now, I plug it into my old computer which st

  • EQ changes

    I am sure this is a bug: in Music settings I have EQ if Off / Sound Check is On / Volume Limit is OFF and yet, when I select the Randomize button in iPod/Music (iPhone4), the sound changes (equalizer settings?). Either way it doesn't make sense!! And

  • Missing method "setfocus"

    I'm getting the Error: hostPsuedoModel does not have a method 'setfocus'   do we have something installed wrong.  Designer version, 8.2.1.....

  • Original file could not be found.  Do you want to locate it?

    We tried to connect a second Ipod to our computer and itunes is giving us the following error. "The song (song name) could not be used because the original file could not be found. Do you want to locate it?". We have our songs on an external hard dri

  • I don't remember my security answer , how to reset

    Help