Dbcp question

Hi,
I am trying to use Jakarta's dbcp package for connection pooling in a standalone application with MySQL database. I've taken a look at the samples at:
http://cvs.apache.org/viewcvs.cgi/jakarta-commons/dbcp/doc/
I would like to manually configure the pool options. There are 2 examples there, one using PoolingDriver, other using PoolingDatasource. Can someone tell me what the difference is between the 2, and which one be more suitable for me?

A connection....
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Connection.html
A datasource....
http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html
Choosing between the two depends on the requirements of the application and the enterprise. And so requires far more information than you provided.
Using connections will be easier. And likely is all that you need.

Similar Messages

  • DBCP questions

    Hi,
    I'm developing a Java application that queries an Oracle 8.1 database.
    This application is executed through command prompt and will receive requests for information through TCP connections. When a request comes, the Oracle database will be queried to check the status of the request.
    Currently, I'm using Jakarta Commons DBCP to do Connection Pooling. Currently the application is being developed on a Windows machine but will need to be running on a Linux machine. What I'm wondering is if the Jakarta Commons DBCP is supported on a Linux platform?
    Also, I'm a bit confused to how the Connection Pool works with my application.
    I have a DBConnPool object that has two methods:
    retrieveConnection() - returns a Connection object from the pool
    releaseConnection() - closes the Connection (conn.close());
    The Connection object is obtained through a PoolingDataSource object.
    I'm wondering:
    1. Will conn.close() in the releaseConnection method release the Connection to the pool?
    2. How should other objects interact with the DBConnPool object? I'm assuming that there should only be one DBConnPool (in main?)
    Sorry for so many questions.
    Thanks in advance!

    Why not. Java is for all platforms. DBCP doesnt force you to use a web server. For a standalone application using a connection pooling, you just need a JDBC driver for oracle, and DBCP libraries. If you want samples code, you will have plenty at : http://cvs.apache.org/viewcvs/jakarta-commons/dbcp/doc/ . Check the samples from this site. They shows how to setup a DBCP pool for standalone applications. It is terrifically simple to setup . Only three or four lines of code. Thats all
    thanks
    boolee

  • Global variable in servlet & DBPooling questions

    Hello guys,
    I used to develop PHP/ASP, and am new to servlet. I have been searching around for a solution ...
    With Php, we can get the reference of a global variable in any classes->functions...
    How do I do this with servlet ?
    And second..I have developed the DB class as below... I set the datasource to be static, so it initializes only once. Is it a good idea? How would you like to improve this class? any comments?
    package shop.database;
    import javax.sql.DataSource;
    import java.sql.*;
    import org.apache.commons.dbcp.BasicDataSource;
    import org.apache.log4j.Logger;
    import shop.admin.exception.GeneralException;
    public class DdManager {
         static protected Logger logger = Logger.getLogger(DdManager.class);
         private String userName = "root";
    private String password = "";
    private String hostName = "jdbc:mysql://localhost:3306/shop";
    private String database="shop";
         static private DataSource ds;     // set this to be static so all threads share the same job in JVM
         private Statement stmt;
         private Connection conn;
         private ResultSet rs;
         private CallableStatement cs;
    public DdManager() {}
    * setup the data source and return it
         public static DataSource getDataSource(
              String sDrvName,
              String sUserName,
              String sPwd,
              String connectURI) {
              BasicDataSource ds = new BasicDataSource();
              ds.setDriverClassName( sDrvName );
              ds.setUsername( sUserName );
              ds.setPassword( sPwd );
              ds.setUrl( connectURI );
              ds.setMaxActive( 15 );
              ds.setMaxIdle( 10 );
              ds.setMaxWait( 10000 ); // 10 seconds
              return ds;
         * static init of the class
         * this class is will be called only once to initialize the DataSource
         static {
              try {
                   Class.forName( "com.mysql.jdbc.Driver" );
                   ds = getDataSource(     "com.mysql.jdbc.Driver",
                                            "root",
                                            "jdbc:mysql://localhost:3306/shop" );
                   if (ds == null) {
                        String msg = "Connection Pool error";
                        logger.error(msg);
                        throw new GeneralException(msg);
                   logger.info("DataSource has been initialized");
              } catch(Exception exception) {
                   logger.error(exception.toString());
                   try {
                        throw new GeneralException(exception.toString());
                   } catch (GeneralException e) {
                        logger.error(e.toString());
         * get the connection from the pool (DataSource)
    public void openConnection() throws GeneralException {
    try {
         BasicDataSource bds = (BasicDataSource) ds;
         logger.info("NumActive: " + bds.getNumActive() + ", " + "NumIdle: " + bds.getNumIdle());
    conn = ds.getConnection();
    logger.info("Connection of " + database + " has been established");
    } catch(Exception exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * close the connection will actually return the connection to the pool (Must)
    public void closeConnection() throws GeneralException {
         initResource();
    try {
         if (conn != null){
                   conn.close();
                   logger.info("Connection of " + database + " has been closed");
    } catch(SQLException exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * prepare the calling stmt
    public void prepareProcedure(String callStatement) throws GeneralException {
         initResource();
    try {
         cs = conn.prepareCall(callStatement);
    } catch(SQLException exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * set the pass-in parameter for "String"
    public void setParameter(int position, String parameter) throws GeneralException {
    try {
         cs.setString(position, parameter);
    } catch(Exception exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * set the pass-in parameter for "Integer"
    public void setParameter(int position, int parameter) throws GeneralException {
    try {
         cs.setInt(position, parameter);
    } catch(Exception exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * execute the procedure and return the resultset
    public ResultSet execProcedure() throws GeneralException {
    try {
         rs = cs.executeQuery();
    } catch(SQLException exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    return rs;
    * close the statment and resultset
         private void initResource() throws GeneralException {
         try {
              if(rs != null) {
                   rs.close();
              if(stmt!= null) {
                   stmt.close();
              logger.info("Statement & Resultset have been free");
         } catch(Exception exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    Thanks mates!
    myy

    Thanks Saish,
    Your response is really appreciated. Sorry about that
    as i didnt know there is 'code' formatting button,
    and I will look into the Singleton pattern.
    As I'm still in the learning stage. Therefore, i
    still have a lot of thing do not understand.
    ... use it in a method signature ...What is "a method signature" ?
    A method signature is basically the method's parameters, return value, name and any access or other modifiers. The following is a method signature:
    static final public void main(final String[] args)Between the braces of the method body is the implementation (or as I already alluded to, the method body).
    Consider using an already-developed connection poolimplementation, such as Jakarta Commons DBCP ...
    I'm trying to implement the Jakarta DBCP. Did I go
    into the wrong way?
    Sorry, did not read the imports. Yes, you are. However, I am confused about what you are trying to implement. You have a static method getDataSource(). You also have a static variable 'ds'. Use one or the other. I would be that there are seemingly random errors cropping up based on whether you remember to call getDataSource() or not.
    You do not, generally, want the data source to be static. Multiple threads might use the class. And if there is only a static data source, you will either need to synchronize the methods that use the data source (resulting in a scaling bottleneck) or not synchronize them (which will totally destroy any concept of a logical unit of work or database transaction).
    .. A static datasource, as in your class, can onlysafely be used by one thread at a time, potentially
    introducing scaling bottlenecks (or race conditions)
    in your system ...
    So, you mean there is no need for the DataSource to
    be static ?
    No, in fact, IMO, it should not be. That is why you are pooling. Use instances. The pool will manage the connections and their availabilty for you.
    Why are you throwing GeneralException everywhere?Here's a question: can someone using your class (a
    caller) realistically be expected to handle a
    database exception?
    When there is a database error, I just want to stop
    the process and redirect the user to an error page. I
    will look into the unchecked exceptions. Thanks.
    Unchecked exceptions do not need to be declared in a method signature or caught within the method body. Checked exceptions do. As such, an added benefit is that unchecked exceptions de-clutter your code.
    In your initResources() method, what happens if theclose() on ResultSet throws an exception
    Oh, yes. I'm so stupid.
    Now I only have ...
         private static DataSource ds;     // set this to
    be static so all threads share the same obj in JVM
         private Connection conn;
         private CallableStatement cs;
    private void initResource() throws GeneralException
    n {
         try {
              if(cs != null) {
                   cs.close();
    logger.info("CallableStatement has been
    as been free");
         } catch(Exception exception) {
         logger.error(exception.toString());
    throw new
    throw new GeneralException(exception.toString());
    You still have issues.
    public void initResources() {
       if (rs != null) {
         try { rs.close(); } catch (SQLException ignore) { ignore.printStackTrace(); }
       if (stmt != null) {
         try { stmt.close(); } catch (SQLException ignore) { ignore.printStackTrace(); }
    }Normally, this type of method would not be called initResources() but rather closeResources() or freeResources(). It would be called from within the 'finally' block of another method using the CallableStatement or ResultSet.
    This is really is problem, would you mind to tell me
    how to handle this(close the connection) if the
    close() on either CallableStatement or Resultset
    throws an exception ?
    See above. Simply log the exception (there is usually nothing meaningful you can do if a close() fails, and it is up to you as a developer if this is an error or just a warning). Another option is to 'chain' exceptions. In your own exception, add a method 'addException(Throwable)'. This would add another exception to a List of exceptions. When you print the stack trace, iterate through the chained exceptions to print them all out. One place where I find this useful is rollback() code. If the original SQL statement fails AND the rollback fails, I definitely want to see that rollback() exception as well in my logs.
    The DB thing makes me headache. What I actually
    wanted is a solution for:
    Let say I have a class "HelloAction.class" contains
    the code:
    public ActionForward XXX() {
         DbManager DB = new DBManager();
         ... do some DB thing here...
         SecondClass SC = new SecondClass();
         SC.doSomeOtherDbThing();
         ... do something else...
         ThirdClass TC = new ThirdClass();
         SC.doMoreOtherDbThing();
    }There are some functions in SecondClass.class and
    ThirdClass.class that will need database connection.
    I consider 'global variable' is because I want these
    two classes are able to use the same
    connection(DbManager) from the function -
    ActionForward XXX().
    What is the best way to implement the above situation
    (sharing the same connection in different classes &
    sub-classes?
    I also just realize that the problem of multi-threads
    with these two class variables..
         private Connection conn;
         private CallableStatement cs;Really headache. I really appreciate any comments.
    Thanks.
    - myyPass the Connection or DataSource to each method or constructor. Call commit() or rollback() from the method that created the transaction.
    - Saish

  • Tomcat 5.0.* global JNDI database connect pooling. complex config question

    Ok. I can't get global connection pooling to work in tomcat 5.0.24. (I am running windows xp pro)
    I am using MySQL (installed on the same machine) and I have succesfully worked through the tutorial titled "MySQL DBCP Example" found at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    This example does not demonstrate global connection pooling, however. I want to share a single connection pool across all my web applications. I don't want a different connection pool for each webapp.
    So I define the connection pool JDBC resource in the conf/server.xml file under the <GlobalNamingResources> element.
    Here is the entire <GlobalNamingResources> element lifted from conf/server.xml:
    (Please overlook some of the formatting mistakes due to the <code> tag interpreting the xml as java.)
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
        <Resource name="UserDatabase"
                  auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved">
        </Resource>
        <Resource name="jdbc/MySQL"
                  auth="Container"
                  type="javax.sql.DataSource"/>
        <ResourceParams name="UserDatabase">
            <parameter>
                <name>factory</name>
                <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
            </parameter>
            <parameter>
                <name>pathname</name>
                <value>conf/tomcat-users.xml</value>
            </parameter>
        </ResourceParams>
        <ResourceParams name="jdbc/MySQL">
            <parameter>
                <name>factory</name>
                <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>
            <parameter>
                <name>maxActive</name>
                <value>100</value>
            </parameter>
            <parameter>
                <name>maxIdle</name>
                <value>30</value>
            </parameter>
            <parameter>
                <name>maxWait</name>
                <value>20000</value>
            </parameter>
            <parameter>
               <name>username</name>
               <value>webapp</value>
            </parameter>
            <parameter>
               <name>password</name>
               <value>******</value>
            </parameter>
            <parameter>
                <name>removeAbandoned</name>
                <value>true</value>
            </parameter>
            <parameter>
                <name>removeAbandonedTimeout</name>
                <value>3000</value>
            </parameter>
            <parameter>
                <name>logAbandoned</name>
                <value>true</value>
            </parameter>
            <parameter>
                <name>url</name>
                <value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
            </parameter>
        </ResourceParams>
      </GlobalNamingResources>I am still trying to get the DBTest example (described in the link to the tomcat 5 docs above) to work, only now I want it to work using a global connection pool. So here is the contents of webapps/DBTest/WEB-INF/web.xml: (again, please overlook formatting difficulties :)
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
             version="2.4">
      <description>MySQL Test App</description>
      <resource-ref>
          <description>DB Connection</description>
          <res-ref-name>jdbc/MySQL</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
      </resource-ref>
    </web-app>The last thing I need to do, I think, is to include a <resourceLink> element in the context.xml file for this webapp. Now in tomcat 5.0.* it is not recommended that the <context> element appear in the conf/server.xml file. Instead, as I understand it, it should appear in either of the two following places (for a webapp called DBTest):
    $CATALINA_HOME/conf/[engine_name]/[host_name]/DBTest.xml
    $CATALINA_HOME/webapps/DBTest/META-INF/context.xmlSince I would eventually like to package each webapp in its own war file, I prefer the second option above. This will enable me to place the context.xml file within the .war file. Currently, however, I am not using .war files.
    For the DBTest webapp I have the following <context> element in webapps/DBTest/META-INF/context.xml:
    <context path="/DBTest" docBase="/DBTest" debug="1">
        <ResourceLink global="jdbc/MySQL" name="jdbc/MySQL" type="javax.sql.DataSource" />
    </context>Now, when I point my browser to http://localhost:8080/DBTest/test.jsp I get the following message:
    javax.servlet.ServletException: Unable to get connection, DataSource invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver"
    For those who are interested, here is test.jsp:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <sql:query var="rs" dataSource="jdbc/MySQL">
    select id, foo, bar from javatest.testdata
    </sql:query>
    <html>
      <head>
        <title>DB Test</title>
      </head>
      <body>
      <h2>Results</h2>
    <c:forEach var="row" items="${rs.rows}">
        Foo ${row.foo}<br/>
        Bar ${row.bar}<br/>
    </c:forEach>
      </body>
    </html>Now I know that this is a very long and detailed question and that it is unlikely that anyone is even going to read down this far, let alone take the time to study all that XML, but if anyone is able to tell me why this setup does not allow global connection pooling, I will be pretty *@&$**% impressed. I only wish I had duke dollars to give.
    Jon

    Okay, I went back and double checked that I can get the DBTest example working. It is described here: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    I was not able to get it working exactly according to the tutorial, though. I was required to put the <context> element not in the conf/server.xml but in conf/Catalina/localhost/DBTest.xml. Then, with the DBTest/WEB-INF/web.xml as above, I was able to get the DBTest example working. The output of test.jsp (described above also) is the following:
    Results
    Foo hello
    Bar 12345I would like to be able to put the <context> element in webapps/DBTest/META-INF/context.xml (as I think should be allowed) because then I would be able to include it in a war file that encompassed the entire web application. If I am forced to put the <context> element in a subdirectory of the conf directory, then I cannot include it in a war file and I will be unable to just drop my war files in the webapps directory and go. Instead I will have to drop my war files in the webapps directory, then go and fiddle around with the xml files in conf/Catalina/localhost/
    But if I move the <context> element into webapps/DBTest/META-INF/context.xml then the example stops working. When I put it back in conf/Catalina/localhost/DBTest.xml everything is fine again.
    Ok, no big deal. I guess my war file deployment will just have to be a little more complicated.
    But what if I want the resource to be global??? If I remove the <Resource> and <ResourceParams> elements from the webapp-specific <context> element and put them in the <GlobalNamingResource> element in the conf/server.xml file I should have a global resource, right? I did this, then added a resource link to the <context> element (see above), however, the example stops working. I have tried both with and without the <resource-ref> element in web.xml.
    Can some remarkably intelligent and knowledgeable person please explain to me how global resources work in tomcat 5.0, especially global JDBC connection pooling.
    Thanks,
    Jon

  • KODO DataSource questions

    Our setup:
    Tomcat 5.5, KODO 3.4.1, single transaction per request on the application (application is sessionless).
    Observations:
    1. When we specify javax.jdo.option.ConnectionURL, javax.jdo.option.ConnectionUserName, javax.jdo.option.ConnectionPassword in the properties file, it uses the KODO DataSource specifically com.solarmetric.jdbc.PoolingDataSource.
    2. If we want to use JNDI, we specify javax.jdo.option.ConnectionFactoryName=java:comp/env/jdbc/MyDB in the properties file and then in our tomcat server.xml context we add something like the following:
       <Resource
       name="jdbc/MyDB"
       auth="Container"
       type="javax.sql.DataSource"
       driverClassName="oracle.jdbc.driver.OracleDriver"
       url="jdbc:oracle:thin:@_host_:_port_:_SID_"
       username="_username_"
       password="_password_"
       maxActive="10"
       maxIdle="5"
       maxWait="-1"/> 3. When specifying with JNDI in tomcat, it appears to use the tomcat DataSource (org.apache.tomcat.dbcp.dbcp.BasicDataSource).
    4. Using the tomcat BasicDataSource means that we get no prepared statement caching - this is a documented issue with using third party DataSources.
    5. Using the tomcat BasicDataSource also seems to do a database rollback after every persistence manager 'close', which in our setup equates to each request.
    Questions:
    1. How do we force KODO to use it's own DataSource when using JNDI in tomcat?
    2. How would we force KODO to use a different DataSource in the properties file (like the tomcat BasicDataSource)?
    3. Is there any way to stop the database rollback after each persistenceManager close when using the tomcat BasicDataSource?
    4. Is it recommended to use the KODO DataSource? Are there any reasons to not use it?
    5. What are the main differences between the KODO DataSource and the tomcat BasicDataSource?
    Many thanks in advance.
    Nick

    Can anyone shed some light on how we get statement caching working whilst using JNDI to specify the db connection details? Is this possible???
    Any info/help would be very much appreciated as statement caching is something we would now like to enable.
    Many thanks,
    Nick

  • Datasource question

    Hi. I have a number of jsp pages which contain code as follows:
    <sql:setDataSource dataSource="jdbc/dbtest"/> <sql:query var="items" sql="SELECT * FROM homepagesubscriptions" > </sql:query>
    Now my question is will performance of the app be affected due to referring to the datasource multiple times in these various jsp's. I am just trying to get my head around what a dataource is. I have configured the datasource in my tomcat context file. Am I right in thinking that when the web server starts up, the datasource is initialised once and everytime I reference the datasource from my app it is referring to this same datasource - in which case it is not negatively affecting performance.
    thanks

    i am using connection pooling. Here is what I have in my tomcat context file:
    <Context reloadable="true" docBase="C:\struts2\website" >
         <Resource name="jdbc/dbtest"
              auth="Container"
              type="javax.sql.DataSource"
              factory="org.apache.commons.dbcp.BasicDataSourceFactory"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost/website"
              username="root"
              password="xxxx"
              maxActive="20"
              maxIdle="10"
              maxWait="10000"
              removeAbandoned="true" />
         <Realm className="org.apache.catalina.realm.DataSourceRealm" debug="99"
              dataSourceName="jdbc/dbtest"
              digest="MD5"
                    localDataSource="true"
              userTable="users" userNameCol="user_name" userCredCol="user_pass"
                    userRoleTable="user_roles" roleNameCol="role_name"/>
    </Context>thanks darted

  • Tomcat 4.1 Oracle Blob problem using apache commons DBCP

    Hi all,
    We are using Tomcat 4.1.12, Java 1.4.x and trying to take advantage of the connection pooling that comes with Tomcat(the apache commons DBCP).
    We are connecting to a oracle database.
    Works fine for everything EXCEPT Blobs. We have a servlet that serves images from Oracle, that works fine when it doesn't use the connection pooling, but throws an exception when we call the
    ERROR: Class:DisplayGraphic Method:processRequest(HttpServletRequest request, Ht
    tpServletResponse response)
    Exception: org.apache.commons.dbcp.DelegatingResultSet
    DataSource ds = (DataSource)ctx.lookup("jdbc/db_connection");
    Connection conn = ds.getConnection();
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    pstmt = conn.prepareStatement("SELECT graphic FROM graphics WHERE graphic_id = 1");
    rs = pstmt.executeQuery();
    if(rs.next())
        oracle.sql.BLOB oBlob = ((OracleResultSet) oRS).getBLOB("GRAPHIC");
        InputStream oIS =  oBlob.getBinaryStream();
        ... etc etc...
    }Any ideas?
    Cheers,
    Alex.

    solved the problem.. i was using getBLOB instead of
    getBlob
    doh..Hi Alex,
    your problem is very interesting for me because I have a similar problem and your identical configuration...
    the instruction
    oracle.slq.BLOB aBlob = ((OracleResultSet)super.mRs).getBLOB("BLOBBONE")
    causes this:
    java.lang.ClassCastException: org.apache.commons.dbcp.DelegatingResultSet
    To resolve this, I changed, in server.xml , the factory
    <parameter>
                        <name>factory</name>
                        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                   </parameter>
    with:
    <parameter>
    <name>factory</name>
    <value>oracle.jdbc.pool.OracleDataSourceFactory</value>
    </parameter>          
    and magically all works fine...
    But the question is... Why doesn't it work with the standard factory???
    There is a problem in the CLASSPATH that I don't see?
    Any suggestions is welcome!
    Thanks in advance!
    Giselda

  • DBCP PARAMETERS GOING CRAZY...HELP!!!!!!!!!!!!

    HI,
    I am using tomcat 5.5.9 and Oracle 9i for my production site.
    In between the two is a[b] firewall whose[b] timeout is 15 min. As u can see from the configuration for JNDI JDBC datasource done in my context.xml file for the web application,
    I am using a THIN jdbc driver. So the question of using SQLNET.EXPIRE_TIME does not arise.
    Please help me how to use the parameters below for connection pooling in DBCP efficiently.
    My problem is that after the connections are idled and removed from the pool , as soon as a new request comes,
    the application just hangs!
    It is happening after the time > timeout_firewall
    <Resource name="jdbc/myoracle"
    auth="Container"
    factory="org.apache.commons.dbcp.BasicDataSourceFactory"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@SITO:1521:ABCXYZ"
    username="roger_tiger"
    password="roger_tiger"
    maxActive = "50"
    maxWait = "10000"
    removeAbandoned = "true"
    removeAbandonedTimeout = "60"
    maxIdle = "10"
    validationQuery = "select 1 from dual"
    testWhileIdle = "true"
    initialSize = "10"
    minIdle = "5"
    timeBetweenEvictionRunsMillis = "30000"
    numTestsPerEvictionRun = "3"
    minEvictableIdleTimeMillis = "24000"
    />
    PLease help me as soon as possible.
    any help will be much appreciated...

    On any Unix/Linux machine, you can get the Java JVM to provide a thread dump by sending the QUIT signal to the JVM.
    1) first, find the process ID of the JVM with:
    ps -aef | grep java
    (you might needs different parameters to ps on Linux, I'm not sure
    2) send the QUIT signal to the process id found in step 1 with:
    kill -QUIT process_id
    The output of the thread dump normally goes wherever you've directed system.err to go to, which might be a file or something. If it's being directed to /dev/null, yo have to fix that first.

  • Using DBCP to provide a DataSource for Application Server Plaform Edition 8

    Hi,
    I am trying to intergrate Mckoidb into AS PE 8. Mckoidb does not implement the DataSource interface, so I am considering using Apache DBCP simpy as a wrapper around the Mckoidb connection to satisfy the configuration requirement. My intention would be to simply use DBCP as a means of creating a DataSource object, not as a datapool facility.
    My questions are:
    1) is this doable?
    2) Is it a reasonable way solve the problem?
    3) Any suggestions on a better way to do this?
    This would seem to me to be a fairly common problem as most of the open source databases do not at this point implement the DataSource interface. Possibly a genreric solution is in order until that situation changes.
    Thanks,
    Joel

    I also tried that with AS400 driver without success.
    But I kindly received help (by lancea) with the driver. I found out that in jakarta connection pool, tomcat uses the driver com.ibm.as400.access.AS400JDBCDriver and Application Server's pool uses com.ibm.as400.access.AS400JDBCDataSource.
    When using the new data source class name, the system automacally show me all the necesary properties, the same IBM toolkit describes.
    So maybe you can try other data sources name, maybe you can look at the source, or maybe can ask Mkcoi lists.
    One thing I want you to note. If you create incorrectly the connection pool, it is better to erase it an create a new one to continue trying, because I notice that if you change to the correct parameters the system will not connect.
    Happy coding,
    Lorenzo Jimenez

  • Question about DataSource

    Hi,
    when i read the JDBC 3.0 specification, i found that there should be a set of
    properties and a set of "getter" and "setter" methods such as "getServerName" in the interface DataSource.However, i could not find these fields and methods in the java 1.4.0_01 api doc.there are only a few methods and no fields in the interface. Can anybody be kind enough to tell why? thanks in advance.
    simeon shi

    The getter and setter methods are specific to the DataSource implementer.
    For example a Microsoft SQL Datasource may have a setServer, setPort and setMicrosoftOnly setter whereas a MySQL Datasource my have setServerName, setTCPPort and some other MySQL only setters (and getters). They are kind of like beans (technicly they are beans) in which the setter and getter methods are treated like properties.
    The next question that usually comes to mind is "How do I use this then? It is no longer generic if my app needs to know the specific properties of the DataSource?"
    Datasources are usually used in J2EE applications which typcially have a configuration file that you would put the name of the DataSource Class and the name and values of each property for that DataSource (They are treated like Java Beans). Again, these properties are vendor specific.
    A good way to use a DataSource in a standalone application is to use the DBCP library in the Jakarta-Commons project. Its a nice DataBase Connection Pool library. Tomcat 4.1 and forward seems to use this library over Tyrex.
    - Chris

  • Problem of Jakarta DBCP

    i have been research about Jakarta Commmon DBCP for over a week.
    After reading the offical documentation provided by them, i have some questions about it
    1.
    can a connection fetched from the pool recover after a network crash such as the the line is off or the swither is down?
    i know that a pool has many properties, however, can i control them in the code i wrote?
    2.
    our project must user DBCP in the Driver mode and control it with a JOCL file, but are there some more documentations that can provide more detail introductions to JOCL, including how to define and wirte the tags and so on.
    could anybody help me to resolve the questions ablow, thanks in advanced.
    ipiszhang from BOCSoft, Beijing, China P.R.
    :-)

    Looks like tomcat doesn 't support your locale.
    Catalina.start: java.util.MissingResourceException: Can't find bundle for base
    ame org.apache.coyote.tomcat4.LocalStrings, locale ru_RU
    Try changing your computer's locale and see if that helps.
    Look here for more information on how resource bundles work:
    http://java.sun.com/j2se/1.4.2/docs/api/java/util/ResourceBundle.html

  • Tomcat/Comnmons DBCP/Oracle RAC

    Does anybody know if the commons pooling used in Tomcat will work with RAC 10g?
    I've asked this question elsewhere but don't seem to be getting anybody who knows for sure.
    My impression is that special coding would be required in the initialization of the datasource to use RAC and that commons DBCP does not do this.
    Can anyone confirm or refute this?

    I'm wanting to do this as well.
    I've got a 10g RAC with two nodes. I only want fail-over. I don't want load balancing.
    I'm using Tomcat 6.0.20 and DBCP for the DataSource.
    Some of the stuff I've been finding in my searches has vaguely suggested that I would need to use an Oracle connection pool in order to get fail-over and DBCP can't be made to work. However, that suggestion is vague, and the references are old, and nobody seems to really know what they're talking about. Some people seem to know Tomcat/DBCP but not Oracle. Some people seem to know Oracle but not Tomcat/DBCP. Most people seem to be searching around in the dark like me. The search for information about this has been frustrating.
    This is what I'm thinking:
    url="jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)(ADDRESS_LIST=(LOAD_BALANCE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=host1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=flvr)))"
    The flvr service is set up for both nodes. Will this fail over properly?
    Unfortunately, I don't have a test RAC that would allow me to see
    what happens when I kill the preferred host (host1).

  • Questions on Print Quote report

    Hi,
    I'm fairly new to Oracle Quoting and trying to get familiar with it. I have a few questions and would appreciate if anyone answers them
    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    Thanks and Appreciate your patience
    -PC

    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    I think I posted it in one of the threads2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    Yes, your understanding is correct.3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    No, there is no conc program getting called, you can directly call a report in a browser window, Oracle reports server will execute the report and send the HTTP response to the browser.4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    This is detailed in many threads.Thanks
    Tapash

  • Satellite P300D-10v - Question about warranty

    HI EVERYBODY
    I have these overheating problems with my laptop Satellite P300D-10v.
    I did everything I could do to fix it without any success..
    I get the latest update of the bios from Toshiba. I cleaned my lap with compressed air first and then disassembled it all and cleaned it better.(it was really clean insight though...)
    BUT unfortunately the problem still exists...
    So i made a research on the internet and I found out that most of Toshiba owners have the same exactly problem with their laptop.
    Well i guess this is a Toshiba bug for many years now.
    Its a really nice lap, cool sound (the best in laptop ever) BUT......
    So I wanted to make a question. As i am still under warranty, can i return this laptop and get my money back or change it with a different one????
    If any body knows PLS let me know.
    chears
    Thanks in advance

    Hi
    I have already found you other threads.
    Regarding the warranty question;
    If there is something wrong with the hardware then the ASP in your country should be able to help you.
    The warranty should cover every reparation or replacement.
    But I read that you have disasembled the laptop at your own hand... hmmm if you have disasembled the notebook then your warrany is not valid anymore :(
    I think this should be clear for you that you can lose the warrany if you disasemble the laptop!
    By the way: you have to speak with the notebook dealer where you have purchased this notebook if you want to return the notebook
    The Toshiba ASP can repair and fix the notebook but you will not get money from ASP.
    Greets

  • Question regarding NULL and forms

    Hi all, i have a survey that im working on that will be sent via email.
    I'm having an issue though. if i have a multiple choice question, and the user only selects one of the choices, all the unselected choices return as NULL. is there a way i can filter out anytihng that says "NULL" so it only shows the selected options?
    thanks.
    here is the page that retrieves all the data. thanks
    <body>
    <p>1) Is this your first visit to xxxxxxx? <b><%=request.getParameter("stepone") %></b>
    </p>
    <p> </p>
    <p>2) How did You Learn About xxxxxxx?</p>
    <p><b><%=request.getParameter("steptwoOne") %></b>
      <br>
        <b><%=request.getParameter("steptwoTwo") %></b>
      <br>
        <b><%=request.getParameter("steptwoThree") %></b>
      <br>
        <b><%=request.getParameter("steptwoFour") %></b>
      <br>
        <b><%=request.getParameter("steptwoOther") %></b>
    </p>
    <p> </p>
    <p>3) What was your main reason for visiting xxxxx?</p>
    <p><b><%=request.getParameter("stepthreeOne") %></b>
        <br>
          <b><%=request.getParameter("stepthreeTwo") %></b>
        <br>
          <b><%=request.getParameter("stepthreeThree") %></b>
        <br>
          <b><%=request.getParameter("stepthreeFour") %></b>
        <br>
          <b><%=request.getParameter("stepthreeOther") %></b>
    </p>
    <p>4) did you find the information you were looking for on this site?</p>
    <p><b><%=request.getParameter("stepfour") %>
    <br>
    <b><%=request.getParameter("stepfourOther") %></b>
    </b></p>
    <p>5) Do you plan on using this website in the future?</p>
    <p><b><%=request.getParameter("stepfive") %></b></p>
    <p>6) What is your gender</p>
    <p><b><%=request.getParameter("stepsix") %></b></p>
    <p>7) What is your age group</p>
    <p><b><%=request.getParameter("stepseven") %></b></p>
    8) Would you like to take a moment and tell us how we can improve your experience on xxxxxxxxxx?
    <p><b><%=request.getParameter("stepeightFeedback") %></b></p>

    i was messing around and came up with this. it doesnt remove the null, but if it is null it adds ABC beside it. so i think i might be getting close. i just need to figure out how to replace the null.
    code]
    <b><%=request.getParameter("steptwoFour") %></b>
         <% if (request.getParameter("steptwoFour") == null ) {
         %>
         <% out.print("abc"); %>
         <% }
         %>

Maybe you are looking for

  • No overheads are reflecting in costing estimate

    Dear All, I am facing a problem while creating cost estimate. No overhead caliculation is reflecting. I have done with following configuration Configured a costing vatiant and done with assignment of Valuation Variant--> Costing Sheet --> Base --> ov

  • How can I move clipart to display on the side ?

    I have just upgraded my notebook and now have the latest Microsoft word (at least I think it is). The problem is, accessing clipart isn't as easy as it used to be with my previous older version of Microsoft word. The dialogue box that comes up now ta

  • Master Detail Java Form

    Where can i find any source code of master detail java form without using BC4J?

  • Copy and Paste issues

    my copy function is not copying! It seems that the copy buffer does not get filled with the copied objects. When pasted, it always pastes a blank space) any ideas of where I can start troubleshooting?

  • Uninstall and attempt to re-install, won't let me install again.

    I had iTunes installed before hand, but I never had any money in my account, and I always used other music apps instead of iTunes on my phone. An error kept popping up telling me to contact my support group because there was an error while attempting