How to use JDBC Connection Pools in a standalone application?

Hi, there,
I have a question about how to use JDBC Connection Pools in an application. I know well about connection pool itself, but I am not quite sure how to keep the pool management object alive all the time to avoid being destroyed by garbage collection.
for example, at the website: http://www.developer.com/java/other/article.php/626291, there is a simple connection pool implementation. there are three classes:JDBCConnection, the application's gateway to the database; JDBCConnectionImpl, the real class/object to provide connection; and JDBCPool, the management class to manage connection pool composed by JDBCConnectionImpl. JDBCPool is designed by Singleton pattern to make sure only one instance. supposing there is only one client to use connection for many times, I guess it's ok because this client first needs instantiate JDBCPool and JDBCConnectionImpl and then will hold the reference to JDBCPool all the time. but how about many clients want to use this JDBCPool? supposing client1 finishes using JDBCPool and quits, then JDBCPool will be destroyed by garbage collection since there is no reference to it, also all the connections of JDBCConnectionImpl in this pool will be destroyed too. that means the next client needs recreate pool and connections! so my question is that if there is a way to keep pool management instance alive all the time to provide connection to any client at any time. I guess maybe I can set the pool management class as daemon thread to solve this problem, but I am not quite sure. besides, there is some other problems about daemon thread, for example, how to make sure there is only one daemon instance? how to quit it gracefully? because once the whole application quits, the daemon thread also quits by force. in that case, all the connections in the pool won't get chance to close.
I know there is another solution by JNDI if we develop servlet application. Tomcat provides an easy way to setup JNDI database pooling source that is available to JSP and Servlet. but how about a standalone application? I mean there is no JNDI service provider. it seems a good solution to combine Commons DBCP with JNID or Apache's Naming (http://jakarta.apache.org/commons/dbcp/index.html). but still, I don't know how to keep pool management instance alive all the time. once we create a JNDI enviroment or naming, if it will save in the memory automatically all the time? or we must implement it as a daemon thread?
any hint will be great apprieciated!
Sam

To my knoledge the pool management instance stays alive as long as the pool is alive. What you have to figure out is how to keep a reference to it if you need to later access it.

Similar Messages

  • HELP:Problem in creating a temporary CLOB using JDBC connection pooling

    Hi All,
    i am inserting a large xml document in an xml type column by creating a temporary clob of this document
    tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
    I am not having any success getting the following statement working using a JDBC connection pool rather than a hard coded URL connection
    it works with:
    "jdbc:oracle:thin:@server:port:dbname" connection
    Does NOT work with:
    datasource.getConnection()
    Does any one know how to successfully get this to work?
    urgently plz........

    Hi Dharmi
    Here is a quote of Dafna's post in [another thread in this forum|Re: Copy VC controls]
    CE7.1.1 will be released at September 2008 for ramp-up customers.
    There are many improvements and new capabilities in the new release of Visual Composer for CE7.1.1. Among the new features you can find:
    The missing features from Visual Composer 7.0 (Html view, portal Eventing support (EPCM), JDBC, Undo/Redo, and more..)
    Many layout & modeling improvements
    Additional ALV table functionality - export to Excel, switch to chart, configure ALV behavior at design time
    Integration of Visual Composer in Eclipse - additional entry point to the Visual Composer models from the NWDS. This integration provides the option to add a WD component (in case of missing functionality in Visual Composer), as a black box component to the Visual Composer model. Right-clicking the component will open the Web Dynpro perspective for creating/modifying the component.
    Regards,
       Shai

  • How to use my connection pool in multiple servlets?

    I now have a functioning connection pool using these lines in a servlet:
    private Connection getConnection(String lookup) throws NamingException, SQLException {
    Context context = new InitialContext();
    DataSource ds = (DataSource)context.lookup(lookup);
    Connection ocon = ds.getConnection();
    context.close();
    return ocon;
    } // private Connection getConnection(String lookup) throws NamingException, SQLException {
    ========================
    If I want to create additional servlets in the same web app which query the same database,
    do I need to repeat this block of code in every servlet, or can I just put it in one servlet
    and have other servlets access it in some way to get a connection? Should I change the code
    above from a "private" Connection to a "public" Connection?
    An example servlet is shown below. To put my question another way: If I want to
    create a second servlet with a different set of queries, would I just make a copy of the first
    servlet and then change only the queries, or is there a more efficient way to have multiple
    servlets get connections from the pool?
    Any suggestions are greatly appreciated.
    Thank you.
    Logan
    ************************************servlet example**********************************
    package CraigsClasses;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import java.net.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.Date;
    import java.text.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    public class CraigsMain extends HttpServlet {
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    private Connection getConnection(String lookup) throws NamingException, SQLException {
    Context context = new InitialContext();
    DataSource ds = (DataSource)context.lookup(lookup);
    Connection ocon = ds.getConnection();
    context.close();
    return ocon;
    } // private Connection getConnection(String lookup) throws NamingException, SQLException {
    // Process the http Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException {
    try {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String sql = "select formtitle from checkboxforms where cbformid = 157";
    // error occurs at this line
    Connection ocon = getConnection("java:comp/env/jdbc/CraigsList");
    PreparedStatement pStmt = ocon.prepareStatement(sql);
    ResultSet rs1 = pStmt.executeQuery();
    rs1.next();
    out.println("<br>" + rs1.getString(1));
    rs1.close();
    pStmt.close();
    ocon.close();
    } catch(SQLException sqle) {
    System.err.println("sql exception error: " + sqle);
    } catch(NamingException ne) {
    System.err.println("naming exception error: " + ne);
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    =======================================================================

    sjasja, Thank you for the reply. What you are suggesting is exactly what I have been looking for. But I'm pretty weak on how to make this separate con pool servlet work. My first attempt is shown below. It doesn't compile this line, which is obviously wrong:
    public static Connection getConnection(String lookup) throws NamingException, SQLException {
    Could you please help me with this servlet code? Thanks.
    package CraigsClasses;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import java.net.*;
    import java.io.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    public class ConPoolInit extends HttpServlet {
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    try {
    public static Connection getConnection(String lookup) throws NamingException, SQLException {
    Context context = new InitialContext();
    DataSource ds = (DataSource)context.lookup(lookup);
    Connection ocon = ds.getConnection();
    context.close();
    return ocon;
    } // private Connection getConnection(String lookup) throws NamingException, SQLException {
    } catch(SQLException sqle) {
    System.err.println("sql exception error: " + sqle);
    } catch(NamingException ne) {
    System.err.println("naming exception error: " + ne);
    =======================================

  • I want to Know how to use JDBC connection with postgress sql on Linux

    Hello friends R u Listen to me?
    Pls help me for making JDBC connectivity with postgress Sql On Linux by using Type 4 Driver .
    Is there is any envoirnment setting rqr then pls send me the same on my mail
    My mail is [email protected]
    varsha

    dcminter wrote:
    http://java.sun.com/docs/books/tutorial/jdbc/index.html
    and
    http://www.postgresql.org/docs/
    ;-)

  • Issues with JDBC Connection Pooling

    Hi all,
    I'm experiencing some unexpected behaviour when trying to use JDBC Connection Pooling with my BC4J applications.
    The configuraiton is -
    Web Application using BC4J in local mode
    Using Default Connection Stagegy
    Stateless Release Mode
    Retrieving Application Modules using Configuration.createRootApplicationModule( am , cf );
    Returning Application Modules using Configuration.releaseRootApplicationModule( am, false );
    Three application modules
    AppModuleA - connects to DatabaseConnection1
    AppModuleB - connects to DatabaseConnection2
    AppModuleC - connects to DatabaseConnection2
    My requirement is to -
    Use App Module Pooling and have individual pool for each Application Module
    Use JDBC Pooling and have individual pool for each Database connection
    Note: All configuration was achieved in design mode (i.e. right clicking AppModule->Configurations...)
    1. Initial approach -
    In the configuration for each Application Module I specified the connection type as 'JDBC Datasource' and specified to approriate datasource.
    Tried setting doConnecitonPooling to 'true' as well as 'false'
    In the data-sources.xml I specified all the appropriate info including min-connections and max-connections.
    I would expect, with the above config that BC4J would use OC4J's built in JDBC connection pooling.
    2. Second approach -
    In the configuration for each Application Module I specified the connection type as JDBC URL.
    In the configuration I specified doConnectionPooling = 'true' as well as the max connection, max available and min available
    What I experienced in both cases was that the max connections seem to be ignored as the number of connection as reported by the database (v$session) was exceeded by more than 10.
    In addition to this once the load was removed the number of JDBC connecitons did not drop (I would have expected it to drop to max available connections)
    My questions are -
    1. When specifying to use a 'JDBC Datasource' style of connection, is it in fact OC4J that is then responsible for pooling JDBC connections? And in this case should BC4J's doConnectionPooling parameter be set to true or false?
    2. Are there any known issues with the use of the JDBC Conneciton Pool as stated by the above to approaches?

    Thanks for the additional info. Please see my comments. below.
    Sorry should have been more specififc -
    1. Is each application pool using a different JDBC user? You mentioned DatabaseConnection1 and DatabaseConnection2
    above; are these connections to different schemas / users? If so, BC4J will create a separate connection pool for each
    JDBC user. Each connection pool will have its own maximum pool size.
    Each 'DatabaseConnection' refers to a different database, actually hosted on a seperate physical server, different
    schema and different user.BC4J will maintain a separate connection pool for each permutation of JDBC URL / schema. If each user is connecting
    to a different DB instance then I would expect no greater than 10 DB sessions. However, if a DB instance is hosting
    more than user then I would expect greater than 10 DB sessions (though still no more than 10 DB sessions per user).
    2. Are all the v$session sessions related to the JDBC clients? There should be at least one additional database
    session which will be related to the session that is querying v$session.
    When querying the v$session table I specifically look for connections from the user in quesiton and from the machine
    name in question and in doing so eliminate the database system's connections, as well as the query tools'
    connection. One area I'm not sure about is the connection BC4J uses to write to its temporary tables. I am using
    Stateless release mode and have not explicetly stated to save to the database but I'm wondering if it still does if so
    and how does it come into the equation with max connections?BC4J's internal connections are also pooled and the limits apply as mentioned above. So, if you have specified
    internal connection info for a schema which is different than the users above I would expect the additional conns.
    One helpful diagnostic tool, albeit programmatic, might be to print the information about the connection pools after
    your test client(s) have finished. This may be accomplished as follows:
    // get a reference to the BC4J connection pool manager
    import oracle.jbo.server.ConnectionPoolManagerFactory;
    import oracle.jbo.server.ConnectionPoolManagerImpl;
    import oracle.jbo.pool.ResourcePool;
    import java.io.PrintWriter;
    import java.util.Enumeration;
    // get the ConnectionPoolManager. assume that it is an instance of the supplied manager
    ConnectionPoolManagerImpl mgr = (ConnectionPoolManagerImpl)ConnectionPoolManagerFactory.getConnectionPoolManager();
    Enumeration keys = mgr.getResourcePoolKeys();
    PrintWriter pw = new PrintWriter(System.out, true);
    while (keys.hasMoreElements())
    Object key = keys.nextElement();
    ResourcePool pool = (ResourcePool)mgr.getResourcePool(key);
    System.out.println("Dumping pool statistics for pool: " + key);
    pool.dumpPoolStatistics(pw);
    }

  • ResultSet problem with a jdbc connection pool implementation

    Hi
    I'm trying to use jdbc connection pool in my java application (js2e 1.4.0_01)
    from the example at http://www.developer.com/tech/article.php/626141
    In my main() code, in addition to JDBCConnection, JDBCConnectionImpl and JDBCPool classes, i use
    JDBCConnection conn;
    conn = new JDBCConnection(dbName);
    // make a statement
    sqlString = "SELECT........."
    ResultSet rs = null;
    rs = conn.sendRequest(sqlString, rs);
    // print result
    while (rs.next()) {
    Unfortunately i get an error like "ResultSet is closed" in the line corresponding to rs.next. The error disappears if i remove the line
    stmt.close();
    in the method sendRequest of the JDBCConnectionImpl class.
    1) Does anybody knows the solution?
    2) How to close all connections?
    Thanks you in advance.

    Hi ,
    You are closing the statement and then trying to use resultset , which is not going to work .So close then statment after using resultset .Ideally the code should be like this
    try {
    conn = // get the connection
    pstmt = conn.prepareStatement(sql);
    rs = pstmt.executeQuery();
    while ( rs.next()){
    // do something
    catch (Exception ex) {
    finally {
    try {
    if (rs != null)
    rs.close();
    if (pstmt != null)
    pstmt.close();
    if(conn!=null )
    conn.close();

  • JDBC Connection pools and clusters (is max connection for entire cluster?)

    Hi,
    Quick question.
    When using JDBC connection pools in WAS 6.40 (SP13) in a clustered environment. Are the max connections the number
    a)Each application server can use
    b)The entire cluster can use
    Would believe a), but I'd like it confirmed from someoneelse

    Hi Dagfinn,
    your assumption is correct. Therefore, in a cluster environment you'd need to make sure the DB can open <i>Number of nodes X max connections</i>.

  • How to create a connection pooling in Netbeans 6.0 using the oracle driver

    hi all,
    I am using Netbeans 6.0. Apache Tomcat 6.0.14 server, oracle 9i.
    I tried to create a connection pooling using tomcat web server.
    I have included the following code in context.xml and web.xml.
    CONTEXT.XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/network1">
    <Resource name="jdbc/myoracle"
    auth="Container"
    type="javax.sql.DataSource"
    username="scott"
    password="tiger"
    factory="BasicDataSourceFactory"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:odbc:thin:@127.0.0.1:1521:mydb"
    maxActive="20"
    maxIdle="10"
    maxwait="-1"/>
    </Context>
    WEB.XML:
    <?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">
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <resource-ref>
    <description>Oracle Datasource example</description>
    <res-ref-name>jdbc/myoracle</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    After that i have included the following JDBC driver's jar files in the $Catalina_Home/lib folder.
    classes 111.jar,
    classes 111_g.jar
    classes12.jar
    classes 12_g.jar
    classes12dms.jar
    classes12dms_g.jar
    nls_charset11.jar
    nls_charset12.jar
    ocrs12.jar
    ojdbc14.jar
    ojdbc14_g.jar
    Then i stop the tomcat web server and start it again.
    In jsp page i have included the following code:
    Context ctx=new InitialContext();
    Context envctx=(Context)ctx.lookup("java:comp:env");
    DataSource ds=(DataSource)envctx.lookup("jdbc/myoracle");
    Connection con=ds.getConnection(); ----->(In this line an error occured that Connection class cannot be found.)
    please help me how to create a connection pooling and rectify the error in conneciton.
    Thanks in advance

    Please refer
    http://www.netbeans.org/kb/60/web/customer-book.html

  • JDBC connection pool failures when used by JMS stores

              We are using WebLogic 6.1 sp2. We defined a separate connection pool for use by
              a JMS Store.
              <JDBCConnectionPool Name="sybaseJMSPool"
              Targets="cluster00"
              InitialCapacity="2"
              MaxCapacity="10"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;charset=utf8"
              URL="jdbc:sybase:Tds:@jms.db.host@/@jms.db.name@"/>
              (note that the @xxx@ string are replaced by actual values).
              We are using Sybase Jconnect 5.5 to a Sybase ASE 12.5 database.
              We deployed this configuration on a number of environments (testing, staging,
              ..). The actual hardware and network configuration is different for the different
              system, but the WebLogic domain stays the same regarding this issue.
              On the test system we frequently get the following exceptions:
              <Aug 13, 2002 1:56:04 PM CEST> <Alert> <JMS> <www00-test> <node00>
              <ExecuteThread: '6' for queue: 'JMS.TimerClientPool'> <> <> <040048>
              <JMSServer "JMSServer00", store failure while writing message for topic
              OrderChangeTopic, java.io.IOException: JMS JDBC store, connection pool =
              <sybaseJMSPool>, prefix = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              .>
              java.io.IOException: JMS JDBC store, connection pool = <sybaseJMSPool>, prefix
              = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              at weblogic.jms.store.JDBCIOStream.throwIOException
              (JDBCIOStream.java:1213)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1256)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              Before that this message appeared:
              <Aug 13, 2002 11:31:16 AM CEST> <Error> <ConnectionManager> <www00-test>
              <node00> <ExecuteThread: '26' for queue: 'default'> <> <> <000000>
              <Closing: 'weblogic.rjvm.t3.T3JVMConnection@795af6' because of: 'Server
              received a message over an uninitialized connection: 'JVMMessage from: 'null'
              to: '-4555218188801970213S:192.168.13.1:[7001,7001,7002,7002,7001,7002,-
              1]:ADIS:node00' cmd: 'CMD_REQUEST', QOS: '101', responseId: '1',
              invokableId: '287', flags: 'JVMIDs Not Sent, TX Context Not Sent', abbrev
              offset: '34'''>
              This problem did not occur on another system which was used during a 2 day stress
              testing session.
              It seems that the problem occurs after a period in which no user request where
              made. The user requests trigger EJB's that start sending JMS messages.
              When the problem occurs, the JMS messaging systems seems to lock up as no messages
              are received anymore by the different listeners (MDBs).
              Undeploying and redeploying the JBDC connection pool solves the problem. This
              solution is unacceptable in case of a production system.
              A similarly defined connection pool, which is used by the EJBs to make database
              connection, does not manifest this problem.
              <JDBCConnectionPool Name="sybasePool"
              Targets="cluster00"
              InitialCapacity="10"
              CapacityIncrement="5"
              MaxCapacity="50"
              PreparedStatementCacheSize="150"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;JCONNECT_VERSION=6;charset=utf8"
              URL="jdbc:sybase:Tds:@db.host@/@db.name@"/>
              The JDBC connection pool is used as follows by the JDBC store
              <JMSJDBCStore ConnectionPool="sybaseJMSPool" Name="JDBCStore00" PrefixName="JMS00"/>
              <JMSServer Name="JMSServer00" Store="JDBCStore00" Targets="node00">
              <JMSTopic JNDIName="ADIS.JMSError" JNDINameReplicated="false" Name="ErrorTopic"/>
              <JMSTopic JNDIName="ADIS.Status"
              Name="StatusTopic" RedeliveryDelayOverride="300000"/>
              <JMSTopic JNDIName="ADIS.OrderChange" JNDINameReplicated="false"
              Name="OrderChangeTopic" RedeliveryLimit="3"/>
              </JMSServer>
              Turning on the "Test Reserved Connection" with a appropriate test table does not
              help.
              Some sources on the internet tell us that JZ0C0 errors in the Jconnect driver
              can be related to network problems. Nevertheless the connection pool should be
              able to cope with this.
              Can you provide any solution for this ? Or give us hints what can cause the problem
              

    Zhenhao Qi wrote:
    thanks! Joe.
    The SQL statement itself can no longer be simplified, the long excuation time is due to the database size and complicated Select criteria. I can easily reproduce the problem by using this SQL. I tried "BEA's Oracle driver (Type 4): Version 8.1.7,9.0.1,9.2.0". the question can be dissect into 2 pieces:
    1) why the jdbc connection (using oracle.jdbc.OracleDriver) won't return anything if the SQL execution time > 5min, that is probably the Oracle's problem
    2) why the occupied connection pool won't release even I set "Statementtimeout=600", this is Weblogic's problem.
    ZhenhaoHi. Yes, (1) is oracle's problem. (2) may also be. The JDBC spec has very few
    allowances for one thread to interrupt a second thread's JDBC call. If we
    transmit your timeout request by calling setQueryTimeout() on the oracle
    statement, and if you have a weblogic-controlled transaction we call
    Statement.cancel() on any ongoing statement, we end up relying on whether
    the Oracle driver implements and responds to those calls.
    Are you doing weblogic-controlled transactions? Are you/can you
    call Statement.setQueryTimeout() on your statements, or are these
    generated JDBC queries?
    If you can duplicate the problem using the weblogic.jdbc.oracle.OracleDriver
    we have some other debug avenues. This would be good even if you really
    want to use the thin driver, because we will do the same JDBC calls to
    either driver, and the debug would prove (if) we set up a query timeout
    and if we call cancel(). If we do, then we can know that it is the Oracle
    driver failing in these regards.
    Joe

  • Creating jdbc connection pool in weblogic 8.x server using oracle database

    Hi
    i am having oracle 9.2.0 and weblogic 8.1. i am new to oracle and jdbc connection pool. can any one explain how to make connection pool in weblogic.
    what will be the host name, port number??
    can any one explain
    regards,
    sekar.r

    The host name is the name or IP address of the machine running Oracle.
    The port number is the port the DBMS is listening on for connection requests.

  • BLOB / CLOB operations using JDBC connections taken from WebLogic 6.0 connectrion pool

    Hi..
    I need to do some CLOB operations using JDBC connection taken
    from WebLogic 6.0 connection pool. Will weblogic 6.0 supports it.?
    I am getting errors when trying to do it in normal way .
    It seems like ResultSet.getClob() returns an RMI (kind of ) object
    instead of the Clob object.
    If you have any idea . Pls respond to [email protected]
    Nazilin

    Hi..
    I need to do some CLOB operations using JDBC connection taken
    from WebLogic 6.0 connection pool. Will weblogic 6.0 supports it.?
    I am getting errors when trying to do it in normal way .
    It seems like ResultSet.getClob() returns an RMI (kind of ) object
    instead of the Clob object.
    If you have any idea . Pls respond to [email protected]
    Nazilin

  • How do I find out what is using a connection pool

    This morning weblogic 8.1.5 complained it couldn't expand a connection pool because it had reached is max concurrent connects limit.
    The issue I have is that I don't actually know what is using the connection pool. It should be defunct and redundent but obviously not.
    This caused all the threads to be consumed and the managed server hung.
    Does anyone know wether it's possible to interigate the pool to find out what it's doing ? I can't check the db as it's managed by another company and I have a v limited read only account.... I can't even select from v&session.
    Cheers in advance for any help.

    Dave Snaith wrote:
    This morning weblogic 8.1.5 complained it couldn't expand a connection pool because it had reached is max concurrent connects limit.
    The issue I have is that I don't actually know what is using the connection pool. It should be defunct and redundent but obviously not.
    This caused all the threads to be consumed and the managed server hung.
    Does anyone know wether it's possible to interigate the pool to find out what it's doing ? I can't check the db as it's managed by another company and I have a v limited read only account.... I can't even select from v&session.
    Cheers in advance for any help.If the pool is not supposed to be used, disable it via the console,
    and whatever applications are still trying to use it will get
    quick exceptions.
    Joe

  • Weblogic 7.0 , MySQL 3.23 JDBC Connection Pools

    i am using weblogic 7.0 and MySQL 3.23 and right now my objective is to create,
    configure and test a JDBC
    connection pool using the Administrative console.
    Here is what i have done till now
    - set the classpath of the MySQL driver in the startWLS.cmd like this
    SET MYSQL_DRIVER=C:\mysqldriver\mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar
    set CLASSPATH=%MYSQL_DRIVER%;%CLASSPATH%
    - using the weblogic administrative console i have created a new connection pool
    named as
    testpool.
    - Here is what i have in the testpool general tab
    Name: testpool
    URL: jdbc:mysql//localhost:3306/test (test is the name of the database in mysql)
    Driver Classname: org.gjt.mm.mysql.Driver
    I have not entered any Properties, ACL Name, Password or Open String Password.
    - Now i go the the Testing tab and enter a name of a table in my test database
    and click on Apply
    and on the command window i am getting the following exception
    java.sql.SQLException No suitable driver
    Thanks in advance,
    Ashish

    Thanks a lot Slava. After reading your mail and the post i was able to get it working.
    "Slava Imeshev" <[email protected]> wrote:
    Hi Ashish,
    I figured out what's the problem. URL in the connection pool
    definition is malformed. It's
    jdbc:mysql//localhost:3306/test
    while the correct one should have colon after mysql:
    jdbc:mysql://localhost:3306/test
    Regards,
    Slava Imeshev
    "Ashish Sureka" <[email protected]> wrote in message
    news:[email protected]...
    I am sorry, the program that i posted here is not comming properlyformatted but
    i am able to run a simple java program that connects to MySQL and alsoa
    servlet
    that connects to the MySQL. The only problem i am having is includingthe
    MySQL
    driver jar files to the weblogic server classpath.
    Thanks,
    Ashish.
    "Ashish Sureka" <[email protected]> wrote:
    Hello Joseph Weinstein,
    Actually, i already tried the same approach that you have mentioned
    in
    your reply
    before i posted my message here. Following is the program that i use
    to check
    MySQL connection.
    import java.sql.*;
    public class MySQLConnect
    public static void main(String[] args) throws Exception
    try {
    Class.forName ( "org.gjt.mm.mysql.Driver" );
    System.out.println ( "MySQL Driver Found" );
    } catch ( java.lang.ClassNotFoundException e ) {
    System.out.println("MySQL JDBC Driver not found ... ");
    throw ( e );
    String url = "";
    Connection con = null;
    try {
    url = "jdbc:mysql://" + "localhost:3306" + "/" + "test";
    con = DriverManager.getConnection(url);
    System.out.println("Connection established to " + url + "");
    } catch ( java.sql.SQLException e ) {
    System.out.println("Connection couldn't be established to " + url);
    String sqlStatement = "SELECT * FROM testtable";
    try {
    Statement s = con.createStatement();
    s.execute (sqlStatement);
    s.close ( );
    } catch ( SQLException e ) {
    System.out.println ( "Error executing sql statement" );
    con.close();
    The classpath that i use to run this program is
    SET PATH=C:\bea\jdk131_03\bin
    SETCLASSPATH=C:\bea\jdk131_03\jre\lib\rt.jar;C:\bea\weblogic700\ebcc\lib\ext\se
    rvlet.jar;C:\CSC413\Demos\HelloApp\HelloAppJAR
    SET CLASSPATH=%CLASSPATH%;C:\bea\weblogic700\server\lib\weblogic.jar
    SETMYSQL_DRIVER=C:\mysqldriver\mysql-connector-java-2.0.14\mysql-connector-java
    -2.0.14-bin.jar
    set CLASSPATH=.;%MYSQL_DRIVER%;%CLASSPATH%
    I have also written a Servlet which checks the MySQL connection. For
    the servlet
    i added the MySQL driver jar files in the WEB-INF/lib directory ofthe
    servlet
    web application and it is working fine.
    do you want me to attach the startWLS.cmd file that i changed to include
    the MySQL
    driver classpath.
    Thanks for your replies,
    Ashish.
    Joseph Weinstein <[email protected]> wrote:
    Ashish Sureka wrote:
    When i start the weblogic server using the command prompt by executingthe startWLS.cmd,
    i can see the classpath the server is using on the command window
    and
    that includes
    the jar file for the MySQL driver but still it is throwing a
    SQLException
    and
    saying that No Suitable driver.
    How do i include a external library or jar file on the weblogic
    server's
    classpath.
    is there a specific directory where i should put the MySQL driver
    jar
    file .
    Thanks,
    Ashish.No. Let's simplfy the problem. Please run a tiny standalone Java
    program
    that
    just makes a JDBC connection to your MySQL DBMS, with no weblogic
    code in the picture. When you succeed at this, show me the CLASSPATH
    and
    PATH of the shell that ran the program successfully, and show methe
    few lines
    of code that made the connection. Then we will know the problem.It
    may
    be that
    the URL you're passing to the pool is not exactly correct for that
    driver.
    Joe
    Joseph Weinstein <[email protected]> wrote:
    Ashish Sureka wrote:
    i am using weblogic 7.0 and MySQL 3.23 and right now my objective
    is
    to create,
    configure and test a JDBC
    connection pool using the Administrative console.
    Here is what i have done till now
    - set the classpath of the MySQL driver in the startWLS.cmd
    like
    this
    SET
    MYSQL_DRIVER=C:\mysqldriver\mysql-connector-java-2.0.14\mysql-connector-java
    -2.0.14-bin.jar
    set CLASSPATH=%MYSQL_DRIVER%;%CLASSPATH%
    - using the weblogic administrative console i have created anew
    connection
    pool
    named as
    testpool.
    - Here is what i have in the testpool general tab
    Name: testpool
    URL: jdbc:mysql//localhost:3306/test (test is the name of
    the
    database
    in mysql)
    Driver Classname: org.gjt.mm.mysql.Driver
    I have not entered any Properties, ACL Name, Password or
    Open
    String
    Password.
    - Now i go the the Testing tab and enter a name of a table in
    my
    test
    database
    and click on Apply
    and on the command window i am getting the following exception
    java.sql.SQLException No suitable driverWatch the first lines that the server prints out when the script
    starts
    it. The script
    shows the classpath that was constructed for the server. It is
    likely
    that you need
    to do something else to ensure your driver is really in the classpath
    the server uses.
    Joe
    Thanks in advance,
    Ashish

  • How to test if connection pool is set up correctly in WL 7 SP 7

    Hi all,
    2 questions.
    1) how do i test if the connection pool i set is working? in the testing tab of the jdbc connection pool in the console page, there is a Test Table Name, i entered 'dual' in the text field. After i clicked apply, there is no indication if i set it up correctly.
    2)After i configure the connection pool, do i need to configure the data sources?

    Could you please try using a "Test_When" statement?
    Karthik

  • Load balancing to JDBC connection pool

    from http://e-docs.bea.com/wls/docs61///////cluster/overview.html
    "WebLogic Server provides limited load balancing support for managing JDBC
    connections in a cluster. If you create an identical JDBC DataSource in each
    clustered WebLogic Server instance and configure those DataSources to use
    different connection pools, the cluster can support load balancing for JDBC
    connections. Note, however, that WebLogic Server provides no special load
    balancing policies for accessing connection pools. If one of your connection
    pools runs out of JDBC connections, the load balancing algorithm may still
    direct connection requests to the empty pool."
    How is this different from creating one connection pool with one datasource
    and targetting the cluster. Are they talking about load-balancing to
    different databases, or different servers in WLS. from a servlet or from a
    client side app?
    Can anyone elaborate?
    Thanks in advance.

    hi,
    without knowing the entire set of requirements or the motivation behind doing this, a few words from me
    this is usually done transparently to the applications server, that is having eg. Oracle instances mirroring eachother for extreme high-availability requirements.
    1. I would have taken the liberty of calling this business funcionality and let my middleware do the implementation of this. The most elegant solution would probably be to call the master DB for the CUD operation, then post a message to a queue letting the slave DB be updated asynchronously. If the message could not be sent, throw an exception and have the entire operation rolled back.
    If however this must happen realtime and transactions must be consistent, there are a few points to consider. And the quieing bit would not work.
    if this is something that should be done for all Create, Update and Delete operations, an intercepting JDBC driver could do the trick. Although there are all sorts of different problems that could arise from this, for starters, at least one of the DBMS involved here should be XA compliant. If the entire transaction should be XA compliant, both DBMS must be XA compliant. Next as for the transaction towards the "mirroring" DBMS you would have to do all the transaction stuff your self.
    For an example of an intercepting JDBC driver, I found thisone
    http://media.datadirect.com/download/docs/jdbc/jdbcref/spy.html
    I would guess that there are quite a few more.
    - [url http://blog.thej2eestruggle.com]Anders Mathisen
    Edited by anders.mathisen at 01/21/2007 2:53 PM

Maybe you are looking for

  • Build-in SMS function for iphone3GS

    I have just started to use my iphone recently. I am a heavy sms user and I find that the current SMS/ Message function in my iphone 3GS is very unfriendly and make me feel very frustrating..the following issues I have encountered and hope some good e

  • Error message cannot be synced

    Whenever i try to sync my ipod an error message pops up. it reads... "The iPod cannot be synced. The disk could not be read from or written to." Can anyone offer advice on how to fix this problem as re-setting and re-installing has not worked. Fifth

  • ITunes does not start on Windows XP

    Last week, iTunes stopped working for me on 10/4. I use it at work only to sync my calendar and contacts with Outlook. in the Windows task manager window process tab, it shows the following processes running: applemobiledeviceservice.exe ipodservice.

  • Where can I find my imported pictures from Iphone in Iphoto and more...

    I'm curious as to the folder where my pictures from the iPhone are stored in the MacBook. I want to take that folder and copy it to an external HD where this issue ... I do it manually. Is it possible to set the iPhoto stores them directly in a locat

  • Opening a project on a different Mac.

    I have a title sequence including lineup, logo etc all the files of which reside on my Mac Hard Disc. I backed up the whole lot on my time machine hard disc, but when I try to open the project on my other Mac, FCP cannot locate the actual files. I th