JDBC Connection Hangs

I'm using the connection pooling system from Jakarta commons. My database access works fine most of the time, but for some reason sometimes the database hangs. I will try to access the web-app and the login screen will come up fine, but when I try to log in the app will just sit there trying to access the database forever, and from that point on no database access will work. Here is the code I use to get the connections and access the database. Is there anything I am doing wrong that could be causing this?
import java.sql.DriverManager;
import java.sql.Connection;
import javax.sql.DataSource;
import java.io.PrintWriter;
import org.apache.commons.pool.ObjectPool;
import org.apache.commons.pool.impl.GenericObjectPool;
import org.apache.commons.dbcp.ConnectionFactory;
import org.apache.commons.dbcp.PoolingDataSource;
import org.apache.commons.dbcp.PoolableConnectionFactory;
import org.apache.commons.dbcp.DriverManagerConnectionFactory;
public class ConnectionManager {
     private static final ConnectionManager INSTANCE = new ConnectionManager();
     //Name of SQL Driver to load
     private static final String DRIVERNAME = "com.mysql.jdbc.Driver";
     private static final String CONNECTSTRING = "jdbc:mysql:///mysite:admin:mypasswd?autoReconnect=true";
     //The actual pool of Database Connections
     private static DataSource dataSource;
     private static ObjectPool connectionPool;
     // Private constructor supresses
     // default public constructor
     private ConnectionManager( ) {
          // Load the Database SQL Driver
          try{
               Class.forName(DRIVERNAME);
          } catch (java.lang.ClassNotFoundException e) {System.out.println ("Database SQL Driver not found!");}
          try {
               // First, we'll need a ObjectPool that serves as the
               // actual pool of connections.
               // We'll use a GenericObjectPool instance, although
               // any ObjectPool implementation will suffice.
               connectionPool = new GenericObjectPool(null);
               // Next, we'll create a ConnectionFactory that the
               // pool will use to create Connections.
               // We'll use the DriverManagerConnectionFactory,
               // using the connect string passed in the command line
               // arguments.
               ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(CONNECTSTRING,null);
               // Now we'll create the PoolableConnectionFactory, which wraps
               // the "real" Connections created by the ConnectionFactory with
               // the classes that implement the pooling functionality.
               PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
               // Finally, we create the PoolingDriver itself,
               // passing in the object pool we created.
               // We then save the datasource object to the class for later use in getting connections
               dataSource = new PoolingDataSource(connectionPool);
               //System.out.println("Idle: " + connectionPool.getNumIdle() + " - Active: " + connectionPool.getNumActive());
               } catch (Exception e){}
     //Returns and Instance of the ConnectionManager object (not really necessary)
     public static ConnectionManager getInstance( ) {
          return INSTANCE;
     //Returns a database connection object
     public static Connection getConnection(){
          Connection conn = null;
          try{
               conn = dataSource.getConnection();
               } catch(java.sql.SQLException e){
                   System.err.print (e.getStackTrace());
          //System.out.println("Idle: " + connectionPool.getNumIdle() + " - Active: " + connectionPool.getNumActive());
          return conn;
And here is my database code:
import java.sql.*;
import com.mysite.ConnectionManager;
import java.util.HashMap;
import java.util.Iterator;
Manages a database after getting a database connection from a {@url ConnectionManager} object.
Can do queries and database updates, as well open and close connections.
public class DatabaseManager {
     private Connection con = null;
     private Statement st;
     private ResultSet rs;
     //The Structure of the Table, used for query operations
     private String[] tableStruct;
     Constructor
     public DatabaseManager(){
     Retrieves a database connection from a {@url ConnectionManager} object.
     @param
     @return
     @see
     public void connect(){
          con = ConnectionManager.getConnection();
     Identifies whether this database connection is still open
     @param
     @return
     @see
     public boolean isClosed() throws java.sql.SQLException{
          return con.isClosed();
     Execute a query on a database connection and get the resultset for that query
     @param queryString A String representing the database query
     @return The results of the query to the database
     @see Statement, ResultSet
     public ResultSet query(String queryString) throws java.sql.SQLException{
          if (con != null){
               st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
               st.executeQuery (queryString);
               rs = st.getResultSet();
               return rs;
          else {
               throw new java.sql.SQLException ("Error has occurred in Datamanager, no Database Connection has been Established.");
     Returns the Number of Rows the last query has executed.
     @return Number of Rows
     public int getRows() throws java.sql.SQLException{
          int count = 0;
          if (rs != null){
               //get the current row number in case were in the middle of a read and want the size
               int rowNumber = rs.getRow();
               rs.beforeFirst();
               while (rs.next()){
                    count = count + 1;
               if (rowNumber == 0){
                    rs.beforeFirst();     
               else {
                    rs.absolute(rowNumber);     
               return count;
          else {
               return 0;
     Does a record in a particular table exist.
     @param tableName name of Table to look in
     @param idName Name if Table ID
     @param id value of ID
     @return True if record exists
     @see
     public boolean doesExist(String tableName, String idName, String id) throws java.sql.SQLException{
          query ("SELECT " + idName + " FROM " + tableName + " WHERE " + idName + "='" + id + "';");
          if (getRows() == 1){
               return true;
          else {
               return false;
     Update a line (or multiple lines) in the database.
     @param updateString The Update Query String to use to update the database
     @return
     public int update(String updateString) throws SQLException{
          int j = 0;
          try {
               st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
               j = st.executeUpdate (updateString);     
          catch (SQLException e) {
               throw new SQLException (updateString);
          st.close();
          return j;
     Update a line in the database.
     @param  tableName Name of table to update the line
     @param  items The data to be updated in the table
     @return
     public int update(String tableName, HashMap items, String idname) throws SQLException{
          // UPDATE <tablename> SET name1="value1", name2="value2" WHERE id="idvalue"
          String updateString;
          Iterator keys = items.keySet().iterator();
          Iterator values = items.values().iterator();
          String optionsString = "";
          //Combine the keys into Strings with ,'s separating.
          while (keys.hasNext()){
               optionsString = optionsString + (String)keys.next() + "=\"" + (String)values.next() + "\",";
          //Chop off the last , in the Strings
          optionsString = optionsString.substring (0, optionsString.length()-1);
          updateString = "UPDATE " + tableName + " SET " + optionsString + " WHERE " + idname + "=" + items.get(idname) + ";";
          return insert (updateString);
     Delete a Record or Records from the database
     @param table Name of the Table to delete data from
     @param whereClause what to delete from the table
     @see
     public void delete(String table, String whereClause) throws SQLException{
          String deleteString;
          deleteString = "DELETE FROM " + table;
          if (whereClause != null) {
               if (!whereClause.equals("")){
                    deleteString += (" WHERE " + whereClause);
          deleteString += ";";
          st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
          st.execute (deleteString);
          st.close();
     Inserts a line of data into a database connection under a given table
     @param insertString String Containing the query to send with the Insert Data
     @return Number of Rows Affected
     public int insert(String insertString) throws SQLException{
          int j = 0;
          try {
               st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
               j = st.executeUpdate (insertString);     
          catch (SQLException e){
               throw new SQLException (insertString);
          st.close();
          return j;
     Inserts a line of data into a database connection under a given table
     @param  tableName Name of table to update the line
     @param  items The data to be updated in the table
     @return Number of Rows Affected
     public int insert(String tableName, HashMap items) throws SQLException{
          // REPLACE INTO <tablename> (itemname1, itemname2) VALUES ("value1", "value2");
          String insertString;
          Iterator keys = items.keySet().iterator();
          Iterator values = items.values().iterator();
          String keysString = "";
          String valuesString = "";
          //Combine the keys into Strings with ,'s separating.
          while (keys.hasNext()){
               keysString = keysString + (String)keys.next() + ",";
               valuesString = valuesString + "\"" + (String)values.next() + "\",";
          //Chop off the last , in the Strings
          keysString = keysString.substring (0, keysString.length()-1);
          valuesString = valuesString.substring (0, valuesString.length()-1);
          insertString = "REPLACE INTO " + tableName + " (" + keysString + ") VALUES (" + valuesString + ");";
          return insert (insertString);
     Sets the table structure for subsequent operations.
     @param An array of names that represent a table in a database.
     @return
     @see
     public void setStructure(String[] struc){
          tableStruct = struc;
     Flushes the Statement and ResultSet object
     in case any resources are being used when they
     shouldn't be.
     public void flushSources() throws java.sql.SQLException{
          if (rs != null){
               rs.close();
               rs = null;
          if (st != null){
               st.close();
               st = null;
     Kills the database connection in this object
     public void close() throws java.sql.SQLException{
          flushSources();
          if (con != null){
               con.close();     
          con = null;     
     }

How do I do that, it doesn't even report an error. I could try sticking log traces all over the place, but it may not tell me anything about why the problem is happening.

Similar Messages

  • Jdbc connection hang?

    I used thin JDBC driver 9.0.1 comes with oracle 9i.
    However, the connection hang in heavy load.
    1. I try to check isClosed(), then reopen is more stable but problem is still exist.
    2. It's more stable than 1. when do.. getConnection, do job and Close it. But another application connect more difficult get some error like 'not found oracle realm' or something.
    Anybody has comment?
    Thanks,
    Kittikun Potivanakul
    [email protected]

    Hi to all and sorry for the delay of my reply.
    I am not using RAC. After setting of the system property +"-Djava.security.egd=file:///dev/random"+ it has solved the +"Connection reset"+ problem, but after about one hour I get +"Connection closed"+ from each connection of the pool when the application uses it.
    The pool uses the implicit cache mechanism of Oracle. Follow the properties of cache:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
    <properties>
    <comment> Oracle connection pool configuration file. </comment>
    <!-- Sets how many connections are created in the cache when it is created or reinitialized -->
    <entry key="InitialLimit">0</entry>
    <!-- Sets the minimum number of connections the cache maintains. -->
    <entry key="MinLimit">0</entry>
    <!-- Sets the maximum number of connection instances the cache can hold. If missing no limit-->
    <entry key="MaxLimit">10</entry>
    <!-- Sets the maximum time a physical connection can remain idle in a connection cache.
    An idle connection is one that is not active and does not have a logical handle associated with it. -->
    <entry key="InactivityTimeout">240</entry>
    <!-- Sets the maximum time that a connection can remain unused before the connection is closed and returned to the cache.
         A connection is considered unused if it has not had SQL database activity. -->
    <entry key="AbandonedConnectionTimeout">240</entry>
    <!-- If no connection is returned to the cache before the timeout elapses, then the connection request returns null. -->
    <entry key="ConnectionWaitTimeout">5</entry>
    <!-- If true causes the connection cache to test every connection it retrieves against the underlying database. If a valid connection cannot be retrieved, then an exception is thrown. -->
    <entry key="ValidateConnection">true</entry>
    </properties>
    Edited by: user12098943 on Aug 24, 2011 10:31 AM

  • Lot of cursors hanging even the jdbc connection are closed

    We use tomcat and thin oracle driver for out application. But we found lot of cursors hanging even the jdbc connection are closed.
    We use a connection pool to manage the connections.

    after properly closing the connections ,try to set all the Connection objects and ResulSet objects to null (force to null) , most likely these inactive sessions will dissapear.
    might be a java garbage collection issue?
    anyhow. I managed to get most of these inactive sessions to disappear. although I am using a Servlet. some of them are still not closed
    Regards

  • Broken pipe, DMLException: JBO-26061: Error while opening JDBC connection

    Hi,
    We are facing strange problem with oc4j903 container using bc4j getConnection() method.
    We are getting the following error intermitantly using bc4j getConnection() method.
    ApplicationModuleProvider JBO-30003: The application pool (bc4j_paris) failed to checkout an application module due to the following exception:
    oralce.jbo.DMLException: JBO-26061: Error while opening JDBC connection.
    and then it says ,
    java.sql.SQLException: Io exception: Broken pipe.
    It gets connection automatically in a matter of minutes.
    Has anybody faced these problem or anyone has the solution please help us out.
    Thanks,
    Chinna

    Bhaskar -- BC4J related questions are better directed to the JDeveloper forum; that's where the BC4J PMs and developers hang out.
    cheers
    -stevee

  • DMLException: JBO-26061: Error while opening JDBC connection, Broken pipe

    Hi,
    We are facing a strange problem with oc4j903 container using bc4j getConnection() method.
    We are getting the following error intermitantly using bc4j getConnection() method.
    ApplicationModuleProvider JBO-30003: The application pool (bc4j_paris) failed to checkout an application module due to the following exception:
    oralce.jbo.DMLException: JBO-26061: Error while opening JDBC connection.
    and then it says ,
    java.sql.SQLException: Io exception: Broken pipe.
    It gets connection automatically in a matter of minutes.
    Has anybody faced these problem or anyone has the solution please help us out.
    I appreciate your inputs.
    Thanks,
    Chinna

    Bhaskar -- BC4J related questions are better directed to the JDeveloper forum; that's where the BC4J PMs and developers hang out.
    cheers
    -stevee

  • View # of current Connection of jdbc connection pool

    Do you guy know of ANY METHODS of viewing # of current database Connection of jdbc connection pool in SUNAPP SERVER?
    for example i have jdbc/Dashboard Connection Pool in SUNAPP SERVER and I wanted to view, at any point of time, how many connection database that it is being utilized during that time. The reason I wanted to see the # of currection jdbc connection is because my Max (400connections) ran out or hanging really long period of time.
    Thanks,
    Kelvin

    There is no way currently to do this

  • Errors using weblogic sql driver: "No JDBC connection can be made because the transaction state is marked rollback"

    One of our customers starts to encounter this error message recently.
    We checked our log files. It seems that the error happens when
    to obtain a jdbc connection. Have anyone seen similar problems
    and knows how to fix it? thanks in advance.
    We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
    The functions that invoke the jdbc calls are stateless session bean
    methods with their transaction attributes marked as Required.
    There is no nested calls of these methods.
    A partial stack trace we obtained is as following:
    java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Marked Rollback
         at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)
         at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
         at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
         at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
    lixin

    Joseph Weinstein <[email protected]> wrote:
    >
    >
    YuanHui Liu wrote:
    Joe,
    We got the exact same error message. The error came after we got theJDBC connection,
    and trying to create statement off it.
    It occurs intermitently when we are running another standalone JAVAapp to do
    some end of day work, which results in the DB Server being very busy(90+%CPU
    usage) for about 5 minutes. We see a surge of requests to the WLSJDBC Connection
    pool. This would sometimes result in all our subsequent DB requeststo fail and
    lead to a crash.
    We are using WLS6.0SP1. I do not think there's a 30 seconds wait leadingto a
    connection timeout that caused this(rather it is the end effect).
    Can you give us a more detailed explanation? Is there a miscommunicationbetween
    our DB(Sybase12) and WLS?Hi. It looks to you like it's after you get the connection, but really
    it's when the server is
    gettng the pool connection. For performance/synchronization reasons we
    do a clever
    delay: When your code asks for a pool connection we quickly give you
    the pool wrapper,
    but we delay actually reserving the real underlying DBMS connection until
    your first
    real need for a connection, at your first JDBC call, such as createStatement()
    etc.
    It is while waiting for a pool connection long enough for the transaction
    coordinator
    to have timed you out before you ever get a chance. It's nothing to do
    with the
    DBMS or even JDBC, I believe. I think the weblogic server either has
    too few execute-threads
    and/or too few CPU cycles to do the work load.
    Okay, so there's a lazy initialization of the connection.
    From reading our log I believe our failur is immediate rather
    than waiting for 30+ seconds(the default setting) from the DB,
    the timeout occurred later as a result. At the time either because the DB Server
    is very busy.
    Since we are running WLS6.0 we have only one connection pool,
    we have defined a max of 150 threads in the pool. While this
    is happening the DB Server is being pinned by an overnight job,
    but the WLS Server is not busy at all. The DB and WLS resides
    on different physical boxes.
    We also have a thread dump from the WLS console when we rebooted the server, it
    showed that we are hanging on to the thread & jdbc
    connections after these exceptions has occurred instead of releasing them, note
    "16083"(~4.5 hours) seconds has passed:
    142 116222 Retry rollback request for tx: 'transaction=(IdHash=2963855,Name =
    [EJB UserManagerBeanImpl.signalICUserServletHeartBeat()],Xid=30643:8f3838f3709bf53d,Status=Rolling
    Back. [Reason = Unknown],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since
    begin=16083,seconds left=10,ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=started,assigned=server),SCInfo[server]=(state=active),properties=({weblogic.jdbc=t3://159.55.158.25:8005,
    weblogic.transaction.name=[EJB UserManagerBeanImpl.signalICUserServletHeartBeat()]}))'
    Scheduled Trigger
    So I would argue this problem actually chewed up resources on the WLS server.
    -Yuanhui Liu
    >>
    >>
    Thanks.
    -YuanHui Liu
    Joseph Weinstein <[email protected]> wrote:
    lixin wrote:
    One of our customers starts to encounter this error message recently.
    We checked our log files. It seems that the error happens when
    to obtain a jdbc connection. Have anyone seen similar problems
    and knows how to fix it? thanks in advance.
    We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
    The functions that invoke the jdbc calls are stateless session bean
    methods with their transaction attributes marked as Required.
    There is no nested calls of these methods.
    A partial stack trace we obtained is as following:
    java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Marked Rollback
    at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)Hi. This sounds like a JVM thread starvation issue, and/or a server
    load
    issue. What is
    happening is that the transaction is started, and times out beforethe
    SSB even gets to
    the first JDBC work. I would first verify that the customer is using
    the very latest JVM
    available for the machine.
    Joe Weinstein
    at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
    at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
    at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
    lixin

  • UI Shell template - jdbc connections

    We are using UI shell for our app so we could open mutliple tabs in the application, each tab opens a bounded Task flow with "Always Begin new Transaction" and "No Share Data Control". We limit total no of tabs that a user can be open to 10.
    The problem is because of "Always Begin new Transaction" the data Control (Frame) is holding a DB connection for each tab, so potentailly each user can user or an AM instance can hold up to 10 DB connections.
    My question is , IS there away to release DB connection of Data Control (Frame) when the TAB is not active and DB connection for the TAB this currently active, so we can limit the no of DB connections for the app?
    Thanks
    Ramesh

    Hi Ramesh
    Your conclusions here on why your app is taking is taking out 10 connections is nearly right, but it's the isolated data control scope that causes this, not the Always Begin New Transaction option. Please consult the paper "ADF Task Flow Transaction Fundamentals" and the 3 relating demos on the ADF Architecture Square to get a solid understanding of this:
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adfarchitect-1639592.html
    Those options alone don't control that the connections will be pinned to a particular user session. You'll be familiar that ADF BC Application Module pool parameter control how the AMs activate/passivate, connect to the database and so on. One option to pay attention to is the jbo.doconnectionpooling option (which is false by default).
    This poorly named options would be better named "Disconnect Application Module Upon Release". What it does when false:
    * AM will attempt to hang onto JDBC connection when finished working with request
    * JDBC connection can keep open prepared statements over check in/out from pool
    * If AM is given to new user, rollback called to clear state + AM prepareSession()
    * Faster performance for users assuming they get served same AM
    * But limits scalability, connections are pinned to AM
    What it does when true:
    * AM will drop JDBC connections on completion of request
    * Increases scalability, connections can be reused
    * Forces activation/passivation for every request
    * AM prepareSession() called every new request
    * User performance is slower as prepared statements aren’t cached
    As such you might want to consider setting this to true.
    Regards,
    CM.

  • Error while creating a report that uses Oracle OCI JDBC connectivity

    Please let me know why my CR and LF characters are removed from my forum posting *****
    Hi,
    I was trying to create a report that uses Oracle OCI JDBC connectivity. I am using Eclipse3.4 download from "cr4e-all-in-one-win_2.0.2.zip".  I have successfully created a JDBC OCI connection.
    The connection parameters are given below:
    URL: jdbc:oracle:oci8:@xe
    Database: xe
    username: <userName>
    password: <password>
    I have tested the above connection in Data source Explorer and it works fine!!!
    But I am getting the following error when I drag-and-drop a table from the list of tables. Not sure what I am missing here?  Any help is highly appreciated.
    com.businessobjects.reports.jdbinterface.common.DBException: InvalidURLOrClassName
         at com.crystaldecisions.reports.queryengine.driverImpl.jdbc.JDBCConnection.Open(Unknown Source)
         at com.crystaldecisions.reports.queryengine.JDBConnectionWrapper.Open(SourceFile:123)
         at com.crystaldecisions.reports.queryengine.Connection.br(SourceFile:1771)
         at com.crystaldecisions.reports.queryengine.Connection.bs(SourceFile:491)
         at com.crystaldecisions.reports.queryengine.Connection.t1(SourceFile:2979)
         at com.crystaldecisions.reports.queryengine.Table.u7(SourceFile:2408)
         at com.crystaldecisions.reports.dataengine.datafoundation.AddDatabaseTableCommand.new(SourceFile:529)
         at com.crystaldecisions.reports.common.CommandManager.a(SourceFile:71)
         at com.crystaldecisions.reports.common.Document.a(SourceFile:203)
         at com.businessobjects.reports.sdk.requesthandler.f.a(SourceFile:175)
         at com.businessobjects.reports.sdk.requesthandler.DatabaseRequestHandler.byte(SourceFile:1079)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1163)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:657)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:163)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:525)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:523)
         at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
         at java.util.concurrent.FutureTask.run(Unknown Source)
         at com.businessobjects.crystalreports.designer.core.util.thread.ExecutorWithIdleProcessing$3.doWork(ExecutorWithIdleProcessing.java:182)
         at com.businessobjects.crystalreports.designer.core.util.thread.AbstractCancellableRunnable.run(AbstractCancellableRunnable.java:69)
         at com.businessobjects.crystalreports.designer.core.util.thread.PriorityTask.run(PriorityTask.java:75)
         at com.businessobjects.crystalreports.designer.core.util.thread.PriorityCompoundCancellableRunnable.runSubtask(PriorityCompoundCancellableRunnable.java:187)
         at com.businessobjects.crystalreports.designer.core.util.thread.PriorityProgressAwareRunnable.runSubtask(PriorityProgressAwareRunnable.java:90)
         at com.businessobjects.crystalreports.designer.core.util.thread.PriorityCompoundCancellableRunnable.doWork(PriorityCompoundCancellableRunnable.java:144)
         at com.businessobjects.crystalreports.designer.core.util.thread.AbstractCancellableRunnable.run(AbstractCancellableRunnable.java:69)
         at com.businessobjects.crystalreports.designer.core.util.thread.ExecutorWithIdleProcessing$IdleTask.run(ExecutorWithIdleProcessing.java:320)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Thanks
    Karthik
    Edited by: KARTHIK1 on Oct 14, 2009 9:38 PM

    Hi Ted,
    Thanks for the feedback. I was able to create a report in Creystal Reports Designer 2008 using OCI.  It is not allowing only in the Eclipse plugin. In our environment we are not allowed to user Oracle thin connections and ONLY OCI is allowed.
    1) Can you please let me know if there is a way to do this? 
    2) Will it allow data sources using native database driver?
    3) If so, can I use JRC to create these reports from a desktop java program?
    Thanks & Regards
    Karthik
    Edited by: KARTHIK1 on Oct 15, 2009 4:38 PM

  • Issue JDBC connection pool with Glassfish 3.1.2.2 and Oracle XE 11gR2

    Hello,
    I am experiencing an issue with pinging a JDBC connection Pool.
    I installed the following without any warnings or errors:
    Operating System: Oracle Enterprise Linux 5
    Oracle XE 11gR2 (11.2.0.2.0) database
    Glassfish 3.1.2.2
    I will refer to the steps I did after the installations
    1) In the .profile file of the OS I add the following:
    JRE_HOME=/usr/java/jre1.6.0_31; export JRE_HOME
    JAVA_HOME=/usr/java/jdk1.6.0_31; export JAVA_HOME
    GLASSFISH_DIR=/u01/glassfish3
    GLASSFISH_HOME=/u01/glassfish3/glassfish
    DERBY_HOME=$GLASSFISH_DIR/javadb
    OPEN_MQ_HOME=$GLASSFISH_DIR/mq
    PATH=:$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$HOME/bin:$GLASSFISH_HOME/bin:$DERBY_HOME/bin:$OPEN_MQ_HOME/bin
    export GLASSFISH_HOME
    export DERBY_HOME
    export OPEN_MQ_HOME
    export PATH
    LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib; export LD_LIBRARY_PATH
    . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
    2) I copied the ojdbc6.jar to the $GLASSFISH_HOME/domains/domain1/lib
    3) I login to the Glassfish admin console and created a new JDBC Connection Pool.
    Pool Name: ds_orasys
    Resource Type: javax.sql.DataSource
    Datasource Classname: oracle.jdbc.pool.OracleDataSource
    User: [myschema]
    Password: [myschema password]
    URL: jdbc:oracle:thin:@localhost:1521:xe
    When I ping the connection pool I get the following message in the server log:
    [#|2012-10-23T12:14:37.069+0300|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service|_ThreadID=22;_ThreadName=Thread-2;|RAR8054: Exception while creating an unpooled [test] connection for pool [ ds_orasys ], Connection could not be allocated because: Invalid Oracle URL specified|#]
    [#|2012-10-23T12:14:37.071+0300|SEVERE|glassfish3.1.2|org.glassfish.admingui|_ThreadID=19;_ThreadName=Thread-2;|RestResponse.getResponse() gives FAILURE. endpoint = 'http://212.205.62.217:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=ds_orasys}'|#]
    I tried to use different jar files. I used ojdbc6dms.jar and ojdbc14.jar.
    I also copied the jar files in the $GLASSFISH_HOME/domains/domain1/lib/ext directory as some people suggested. Still no luck. I keep getting the same error messages in the server.log
    Can anybody help me out or point me to the right direction.
    Thank you in advance

    The error is in the URL. It was in front of my eyes and I couldn't see the error. I skipped the ':' before the '@' when I created the pool. It is working fine now.

  • JDBC Connection pool recovery after DB server restart

    I am finding that Kodo is throwing the following exception after I restart
    my database server (mysql). I am doing the database server restart while my
    application server is idle, so it is not during a transaction.
    Communication link failure: java.net.SocketException [code=0;state=08S01]
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    This is presumably due to the JDBC connection pooling. Is there a
    configuration setting that allows Kodo to detect such failures and reconnect
    to the database server without exposing this problem to the application
    code? For example, WebLogic Server's JDBC connection pool has a setting that
    enables testing a connection and recovering from such failures before
    allocating it from the pool.
    Ben

    This is presumably due to the JDBC connection pooling. Is there a
    configuration setting that allows Kodo to detect such failures and reconnect
    to the database server without exposing this problem to the application
    code?Not right now. You can log an enhancement request with our bug database:
    http://bugzilla.solarmetric.com/

  • 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

  • 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>.

  • 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);
    }

  • 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.

Maybe you are looking for

  • Itunes 10 and Quick Time Installation on Windows 7

    I have installed iTunes 10.6.3.25 on a Windws 7 Operating system and I had what appears to be the same problems of not being able to intall the software and I followed the trobleshooting guide on: http://support.apple.com/kb/HT1926 I have now been ab

  • Java console error

    hi i'm using oracle AS 10gR2, i got the below error in the java console when i tried to access specific form. java.lang.ClassNotFoundException: java.io.IOException: open HTTP connection failed at sun.applet.AppletClassLoader.getBytes(Unknown Source)

  • Where can I find classes12.zip

    I have oracle 8.1.6 on HP-UX and try to use JDBC1.2, but I could not find classes12.zip file. Where can I download it from? Thanks

  • My Powermac G4 AGP won't connect to a network through an airport card.

    I have a powermac G4 AGP that won't connect to any networks via airport wireless card.  An error message pops up on the screen after trying to connect.  Displayed is "There was an error when trying to connect to the preferred network." Can anyone hel

  • Account currency does not match document currency

    Hi, We are using SAP Business ONE 2005 A PL 50.  After having created an invoice in USD for an export customer, the payment is made in the local currency amount. When trying to do the incoming payment in the local currency we get Sap error message 17