Java Database Connections couldn't be closed on PI 7.1 EHP1

Hi,  I develop a dynamic web project to PI. And I use Database conection in that web project. Even  I closed the connection in java , Connection doesn't closed and after a while PI pooling size reach the maximum size and PI doesn't response.  I find open connections on MSSQL and connections' status are sleeping, cmd fields are AWAITING COMMAND.  I have to restart  PI these to close that connections.
I get Connections like these code
                        InitialContext cxt = new InitialContext();
               final DataSourceManager dsm = (DataSourceManager) cxt
                         .lookup("dbpool");
                        String lookUpName = dsm.getSystemDataSourceDescriptor().getDataSourceName();
               DataSource ds = (DataSource) cxt.lookup("jdbc/" + lookUpName);
               ds.setLoginTimeout(60);
               conn = ds.getConnection();...
and I close connections like these
                        conn = db.getDefaultDatabaseConnection();
               if (conn != null) {
                    try {
                         conn.setAutoCommit(true);
                         String sql = "INSERT INTO
                         pstmt.close();
                         conn.close();
                    } catch (Exception e) {
                                 } finally {
                         try {
                              pstmt.close();
                              conn.close();
                         } catch (SQLException e2) {
                              e.printStackTrace();
                         e.printStackTrace();
I changed system DataSource's   and i give these parameters
Initial Connections: 5
Maximum Connections: 125
Maximum Time to Wait for Connection: 90
Connection Lifetime (Sec.): 60
Cleanup Interval (Sec.) : 90
it didn't work either
Can anyone hepl me  ?

I would like to make slight changes in code. . Please close the resources only in finally block.
Dont know you are closing resultset or not. If not, you must close it
conn = db.getDefaultDatabaseConnection();
try {
if (conn != null) {
conn.setAutoCommit(true);
String sql = "INSERT INTO
} catch (Exception e) {
} finally {
    try{ 
       if(rs != null){
        rs.close()
     }catch(SqlException se){
        //log it  
   try{
       if(stmt != null){ 
            stmt.close();
     }catch(SqlException se){
        //log it
  try{
   if(conn != null){
     conn.close();
} catch(SQLException ss){
  // log it
} // end of finally
Hope this help.

Similar Messages

  • JDBC is the Acronym of Java Database Connectivity - Yes / No?

    Hi,
    JDBC is the Acronym of Java Database Connectivity - Yes / No?
    I am little bit confused. I got this question in an Inteview.
    I support yes. But some of the compitiors say no.
    What will the real answer?

    Really? Even Sun contradicts themselves here:
    (2002) http://java.sun.com/javase/6/docs/technotes/guides/jdbc/
    and (more importantly) here:
    http://java.sun.com/docs/glossary.html#JDBC
    although here:
    (2001) http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/intro.html
    I think it is simply silly for the latter to state that "JDBC is the trademarked name and is not an acronym" -- Oh really? JDBC doesn't stand for anything? It is all caps just because it is a trademark then? hmmm.
    I'm certain the real answer of what it stands for may have been lost long ago. However, I doubt that the interviewer meant the question to be a trick and was looking for "Java DataBase Connectivity"
    For every instance that you find that it doesn't stand for anything, I can show you 2 instances (from Sun or an employee) where they use "Java Database Connectivity (JDBC)".
    P.S. Ryan Craig may be the final authority on this...

  • How we build Java Database Connectivity for Oracle 8i Database

    Can any one send me a sample code for Java Database Connectivity for Oracle 8i Database
    it will be a grat help
    Thanks & Regards
    Rasika

    You don't need a DSN if you use Oracle's JDBC driver.
    You didn't read ANY of the previous replies. What makes you think this one willk help? Or any instruction, for that matter?
    Sounds like you just want someone to give it to you. OK, I'll bite, but you have to figure out the rest:
    import java.sql.*;
    import java.util.*;
    * Command line app that allows a user to connect with a database and
    * execute any valid SQL against it
    public class DataConnection
        public static final String DEFAULT_DRIVER   = "sun.jdbc.odbc.JdbcOdbcDriver";
        public static final String DEFAULT_URL      = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        public static final String DEFAULT_DRIVER   = "com.mysql.jdbc.Driver";
        public static final String DEFAULT_URL      = "jdbc:mysql://localhost:3306/hibernate";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        /** Database connection */
        private Connection connection;
         * Driver for the DataConnection
         * @param command line arguments
         * <ol start='0'>
         * <li>SQL query string</li>
         * <li>JDBC driver class</li>
         * <li>database URL</li>
         * <li>username</li>
         * <li>password</li>
         * </ol>
        public static void main(String [] args)
            DataConnection db = null;
            try
                if (args.length > 0)
                    String sql      = args[0];
                    String driver   = ((args.length > 1) ? args[1] : DEFAULT_DRIVER);
                    String url      = ((args.length > 2) ? args[2] : DEFAULT_URL);
                    String username = ((args.length > 3) ? args[3] : DEFAULT_USERNAME);
                    String password = ((args.length > 4) ? args[4] : DEFAULT_PASSWORD);
                    System.out.println("sql     : " + sql);
                    System.out.println("driver  : " + driver);
                    System.out.println("url     : " + url);
                    System.out.println("username: " + username);
                    System.out.println("password: " + password);
                    db = new DataConnection(driver, url, username, password);
                    System.out.println("Connection established");
                    Object result = db.executeSQL(sql);
                    System.out.println(result);
                else
                    System.out.println("Usage: db.DataConnection <sql> <driver> <url> <username> <password>");
            catch (SQLException e)
                System.err.println("SQL error: " + e.getErrorCode());
                System.err.println("SQL state: " + e.getSQLState());
                e.printStackTrace(System.err);
            catch (Exception e)
                e.printStackTrace(System.err);
            finally
                if (db != null)
                    db.close();
                db = null;
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection() throws SQLException,ClassNotFoundException
            this(DEFAULT_DRIVER, DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection(final String driver,
                              final String url,
                              final String username,
                              final String password)
            throws SQLException,ClassNotFoundException
            Class.forName(driver);
            this.connection = DriverManager.getConnection(url, username, password);
         * Get Driver properties
         * @param database URL
         * @return list of driver properties
         * @throws SQLException if the query fails
        public List getDriverProperties(final String url)
            throws SQLException
            List driverProperties   = new ArrayList();
            Driver driver           = DriverManager.getDriver(url);
            if (driver != null)
                DriverPropertyInfo[] info = driver.getPropertyInfo(url, null);
                if (info != null)
                    driverProperties    = Arrays.asList(info);
            return driverProperties;
         * Clean up the connection
        public void close()
            close(this.connection);
         * Execute ANY SQL statement
         * @param SQL statement to execute
         * @returns list of row values if a ResultSet is returned,
         * OR an altered row count object if not
         * @throws SQLException if the query fails
        public Object executeSQL(final String sql) throws SQLException
            Object returnValue;
            Statement statement = null;
            ResultSet rs = null;
            try
                statement = this.connection.createStatement();
                boolean hasResultSet    = statement.execute(sql);
                if (hasResultSet)
                    rs                      = statement.getResultSet();
                    ResultSetMetaData meta  = rs.getMetaData();
                    int numColumns          = meta.getColumnCount();
                    List rows               = new ArrayList();
                    while (rs.next())
                        Map thisRow = new LinkedHashMap();
                        for (int i = 1; i <= numColumns; ++i)
                            String columnName   = meta.getColumnName(i);
                            Object value        = rs.getObject(columnName);
                            thisRow.put(columnName, value);
                        rows.add(thisRow);
                    returnValue = rows;
            else
                int updateCount = statement.getUpdateCount();
                returnValue     = new Integer(updateCount);
            finally
                close(rs);
                close(statement);
            return returnValue;
         * Close a database connection
         * @param connection to close
        public static final void close(Connection connection)
            try
                if (connection != null)
                    connection.close();
                    connection = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a statement
         * @param statement to close
        public static final void close(Statement statement)
            try
                if (statement != null)
                    statement.close();
                    statement = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a result set
         * @param rs to close
        public static final void close(ResultSet rs)
            try
                if (rs != null)
                    rs.close();
                    rs = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a database connection and statement
         * @param connection to close
         * @param statement to close
        public static final void close(Connection connection, Statement statement)
            close(statement);
            close(connection);
         * Close a database connection, statement, and result set
         * @param connection to close
         * @param statement to close
         * @param rs to close
        public static final void close(Connection connection,
                                       Statement statement,
                                       ResultSet rs)
            close(rs);
            close(statement);
            close(connection);
    }%

  • Java database connection method class for review

    Can you guys tell me any specific coding standard has to be followed here(i guess i need not hard code the pwd's)
    import java.sql.*;
    public class DBLocator {
         * Obtains and returns a connection to database
         * @return database connection
         public static Connection getConnection() {
         Connection con = null;
         try {
              Class.forName("com.informix.jdbc.IfxDriver");
              String url = "jdbc:informix-sqli://151.140.160.201:1527/ssde_db:INFORMIXSERVER=ssde_infx";
         con = DriverManager.getConnection(url,"haha06","123123");
    } catch (ClassNotFoundException e) {
                   System.out.println("Driver not found");
              } catch (SQLException e) {
                   System.out.println("SQL exception");
                   e.printStackTrace();
              return con; // returns connection
    }

    Can you guys tell me any specific coding standard has
    to be followed here(i guess i need not hard code the
    pwd's)More than just the passwords. Why are the driver class and URL hard-coded?
    I wouldn't use this class. It's not very useful as written. It's a poor abstraction for one. There's lots of other useful things that you could include, like methods for closing and rolling back a connection, closing a statement and result set. You don't log any exceptions or messages. You preclude the use of a connection pool managed by an Java EE app server.
    %

  • Pooled database connections are not being closed properly

    We are using WLS 9.2 and Microsoft SQL Server 2005 (version 1.1 of the Microsoft JDBC driver), and we are experiencing some strange behavior with the lifecycle of the connections in our data source pools. The WLS console may report that the current capacity of a pool is 5, but the database monitoring tools report that we have more than 5 connections open. It almost seems as though connections are getting dropped somehow and WLS thinks it has closed them and created new ones, but the original connections are never actually closed in the database. Our application is the only thing connecting to the DBMS instance in question, so the connections we are seeing have definitely been created by WebLogic. Any suggestions for tracking down the source of this problem would be greatly appreciated.
    Regards,
    Sabrina

    SabrinaL wrote:
    Thank you for your help. Here is our pool configuration (NOTE: Even though we're not using Oracle, we actually did create our own empty "DUAL" table to use for testing connections):
    <jdbc-connection-pool-params>
    <initial-capacity>10</initial-capacity>
    <max-capacity>10</max-capacity>
    <shrink-frequency-seconds>0</shrink-frequency-seconds>
    <test-frequency-seconds>0</test-frequency-seconds>
    <test-connections-on-reserve>true</test-connections-on-reserve>
    <test-table-name>DUAL</test-table-name>
    </jdbc-connection-pool-params>
    I'm not sure exactly when the problem starts occurring because we only recently
    noticed it; as far as we can tell, it's pretty random. We have seen occasional
    application errors where it appears that the app cannot obtain a connection from
    the pool, but I'm not sure if that issue is directly related to this particular
    problem. We were careful to scale our pool size such that it should always have
    enough connections, so I'm not sure how this is possible. We are running a cluster.
    Regards,
    SabrinaOk, then for every server in the cluster, the server will make 10 connections.
    Because you are using SQLServer, your 'test table' (that is an overloaded
    field) should be set to actually define SQL that we can use for a quick test:
    <test-table-name>SQL select 1</test-table-name>
    That will be quicker than selecting from any real table.
    We would need more info about the problem. If you turn on
    JDBC logging, we might capture the exceptions that indicate
    problems with the pool, however, as configured, the pools
    will have only 10 connections, and will close and replace
    any that fail the test. Do you have a firewall between the
    DBMS and WebLogic?
    Joe

  • Problem in SQL Server 2000 Driver for Java Database Connectivity

    Hi,
    I have problem with MS SQL 2000 JDBC driver. I am using Type-4 driver for my application. I can able to connect through DSN. If I use Type-4 Driver to connect database means it gives the following exception.
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
         at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
         at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
         at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
         at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
         at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
         at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
         at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at test.TestDB.main(TestDB.java:17)
    My Java Code :
    String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
    Class.forName(driver);
    Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.48.90:1433;User=sa;Password=sa;DatabaseName=GWCANADA");
    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery("select * from emp");Do we have any other jdbc driver to connect MS SQL 2000 aprt from the Microsoft JDBC driver.
    Plese help me to resolve this problem
    Thanks
    ---Suresh

    Same problem is here: http://forum.java.sun.com/thread.jspa?threadID=419214&tstart=135
    Check that your server is running (telnet <hostname> 1433)
    --Xapp                                                                                                                                                                                                                                                                                                                   

  • Java Database Connectivity: No suitable driver

    Hello,
    for school I have to make a program that reads from a database and puts the data in an XML file.
    I'm using Corel Paradox 10 for the database. I've configured the ODBC driver correctly as far as I can tell, but when I start the program it keeps saying:
    SQL Exception:
    SQL state: 08001
    message: no suitable driver
    vendor: 0
    The following is the way I configured the driver in corel's BDE administrator:
    type Microsoft Paradox Driver (*.db)
    ODBC DSN ParadoxDump
    There's more settings, but I doubt that that can have anything to do with it, it's mostly numbers and the username.
    Now with the datasources (ODBC) in the windows configuration I have; with both the file-, system-, and the user-DSN the driver from Microsoft for Paradox, all named ParadoxDump, the file being in the directory where the tables are located, the complete filename is ParadoxDump.dsn.
    This the section of my code that deals with the connection:
    public class DumpUtility
         public static void main(String args[])
              try
                   Connection connection = DriverManager.getConnection("jdbc:odbc:ParadoxDump");
                   Statement statement = connection.createStatement();
    Does anyone have any idea why Java can't find the driver, or why the driver is not suitable? If so, does anyone know a away to solve my problem? Whether that be code, reconfiguring the drivers or where I can find a suitable driver and how to configue it if my solution really can't work?

    Looks to me like you forgot to load the driver class. You need to load the driver explicitly, usually using Class.forName("driver.class.here") - that causes the class to register itself with the DriverManager. Then when you call getConnection it uses the URL string (in this case, "jdbc:odbc:ParadoxDump") to search through all the loaded drivers looking for one that recognizes that URL. That's how it knows which driver to use. With no driver loaded, the DriverManager class can't match that URL to a registered driver and that's what it's telling you.
    --PF

  • Java database connectivity

    Hi
    Iam new to jdbc I have to connect java with my sql, could any one please guide me that fom where I can install mysql driver and which one and how to install it and what code needed to include in java programm, i have erade manual but being confused because seen differnt code at differnt places, plz help me.
    thanks

    Hi...
    1) First install MySql
    2) Obtain MySql JDBC Driver --> (http://www.mysql.com/get/Downloads/Connector-J/mysql-connector-java-3.0.9-stable.zip/from/pick)
    3) Add downloaded driver to your Java Proyect library (../lib).
    4) Make Connection
    example:
    Data base url: "jdbc:mysql://ANY_HOST/DB_NAME?user=dbUserName&password=dbPassword"
    Load Driver: "org.gjt.mm.mysql.Driver"
    then connect method can be:
         private void doConnect()throws Exception{
              // db url
              String dbUrl= "jdbc:mysql://localhost/test?user=admin&password=admin";
              try{
                   // load MySql driver
                   Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                   // request one connection
                   this.connection =DriverManager.getConnection(dbUrl);
              }catch (Exception e) {
                   // do something
              return;
    enjoy ! ;-)

  • Question about java dataBase connectivity

    Hello,
    How could I get the name of a column from a table in dataBase ?
    In my code i have :
    ResultSet rss = selectTempo.executeQuery("SELECT LAST_INSERT_ID() AS LAST");
    if(rss.next()){     
    firstColumn= rss.getInt("LAST");
    How could i get the name of LAST in my table ?

    You can probably use the ResultSetMetaData class:
    In you example it might go something like:
    ResultSet rss = selectTempo.executeQuery("SELECT LAST_INSERT_ID() AS LAST");
    ResultSetMetaData meta = rss.getMetaData();From there you can use the different methods that are available in the class. In you case, I think getColumnLabel() should do the trick.

  • AIR application and database connectivity (using JAVA)

    Hi
    I am creating AIR application and I want to connect with the database using java database connectivity (JDBC).
    Can any body give me the some suggestion on how to how to do that.
    Please give me any reference for creating AIR application for database connectivity with mysql/access.
    Thanks
    Sameer

    lots of serching on the google and found that For AIR applications either you use Webservices(JAVA/PHP/.Net) or you can use SQLLite.
    Not found any method for direct connectivity with the database using JDBC.
    If any one found direct connecivity withe database using JAVA then please reply.
    Thanks

  • How to immediately released database connection in jclient form app ?

    Hello Steve,
    We want our jclient form application could immediately released database connection when its be closed,
    We had follow your Weblog technical paper about http://radio.weblogs.com/0118231/stories/2005/02/10/amPoolingConsiderationsForAdfJclient.html , it mentioned following step to release Jclient database connection, but in our jclient project when we close separate jclient form application the database connection seems not immediately released(we monitor through TOAD trace session), the database connection will continue stay alive until we close the all project application.
    •Call panelBinding.releaseDataControl() method before our form application closed,
    •Set the AM pool's minimum available size to 0 (zero), and set the idle time and pool monitor interval shorter if the up-to 20-minute wait (in case it takes two wakeup cycles for the AM instance to be idle more than its idle time) is not something you like, or
    •Disable AM pooling altogether (jbo.ampooling.doampooling=false)In our project application the database connection behavior like following:
    1.when we open every Jclient form application , it will establish a new database connection for every form application
    2.But when we closed the jclient form application , the database connection still exist
    3.But when we open the same jclient form application again, the database connection will not create new database connection , it seems using the same connection when this application first create.
    4.when we close the all project application , it will release all database connection.
    Could you help us, thanks.
    Sincerely from, TIng-Rung

    Hello Steve,
    We have been study the paper that you mentioned, sorry that we still got some confused about AM pool and jdbc pool, My project bc4j,xcfg like following , could you help us what we missing ?
    ==============================
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <BC4JConfig>
    <AppModuleConfigBag>
    <AppModuleConfig name="xxxAppModuleLocal">
    <jbo.ampool.maxinactiveage>5000</jbo.ampool.maxinactiveage>
    <user>xxx</user>
    <jbo.project>His</jbo.project>
    <AppModuleJndiName>com.xxx.business.module.xxxAppModule</AppModuleJndiName>
    <DeployPlatform>LOCAL</DeployPlatform>
    <jbo.poolmonitorsleepinterval>10000</jbo.poolmonitorsleepinterval>
    <jbo.poolmaxinactiveage>5000</jbo.poolmaxinactiveage>
    <JDBCName>NEWNTUHRIS</JDBCName>
    <RELEASE_MODE>Stateless</RELEASE_MODE>
    <jbo.recyclethreshold>0</jbo.recyclethreshold>
    <ApplicationName>com.xxx.business.module.xxxAppModule</ApplicationName>
    <java.naming.factory.initial>oracle.jbo.common.JboInitialContextFactory</java.naming.factory.initial>
    <password>xxxx</password>
    <jbo.poolminavailablesize>0</jbo.poolminavailablesize>
    <DBconnection>jdbc:oracle:thin:@10.0.0.8:1521:xxx</DBconnection>
    <jbo.ampool.minavailablesize>0</jbo.ampool.minavailablesize>
    <jbo.ampool.monitorsleepinterval>10000</jbo.ampool.monitorsleepinterval>
    </AppModuleConfig>
    </AppModuleConfigBag>
    <ConnectionDefinition name="xxx">
    <ENTRY name="JDBC_PORT" value="1521"/>
    <ENTRY name="ConnectionType" value="JDBC"/>
    <ENTRY name="HOSTNAME" value="xx.xx.xx.xx"/>
    <ENTRY name="DeployPassword" value="true"/>
    <ENTRY name="user" value="xxx"/>
    <ENTRY name="ConnectionName" value="xxx"/>
    <ENTRY name="SID" value="xxx"/>
    <ENTRY name="password">
    <![CDATA[{904}0505E5FED797881374FDE8BD1606B6CF01]]>
    </ENTRY>
    <ENTRY name="JdbcDriver" value="oracle.jdbc.driver.OracleDriver"/>
    <ENTRY name="ORACLE_JDBC_TYPE" value="thin"/>
    <ENTRY name="DeployPassword" value="true"/>
    </ConnectionDefinition>
    </BC4JConfig>
    and our jclient code to release connection like following:
    tabbedPane.addCloseListener(new CloseListener(){
    public void closeOperation(MouseEvent e){       
    cleanTabComponentListener(tabbedPane.getComponentAt(tabbedPane.getOverTabIndex()));
    tabbedPane.remove(tabbedPane.getOverTabIndex());
    UPanelBinding panelbd = tabbedPane.getPanelBinding();
    panelbd.releaseDataControl();
    panelbd.getBindingContext().release();
    }

  • Too many database connections and configurator logins ?

    Hi,
    We're having some performance and/or stability problem with Oracle Waveset 8.1.1. patch 2.
    I'm not sure what the problems is yet, but two facts got my attention:
    I noticed for too many database connections waiting to be closed on the OS, varying between 600 and 1200 :
    TCP: IPv4
    Local Address Remote Address Swind Send-Q Rwind Recv-Q State
    doesburg.ic.uva.nl.33555 hopewell.ic.uva.nl.1539 49640 0 49640 0 TIME_WAIT
    doesburg.ic.uva.nl.33556 hopewell.ic.uva.nl.1539 49640 0 49640 0 TIME_WAIT
    doesburg.ic.uva.nl.33557 hopewell.ic.uva.nl.1539 49640 0 49640 0 TIME_WAIT
    doesburg.ic.uva.nl.33558 hopewell.ic.uva.nl.1539 49640 0 49640 0 TIME_WAIT
    etc.
    (doesburg is our Solaris 10 server where the tomcat application server is installed, hopewell is our Oracle 10g database server )
    I also noticed numerous Configurator logins in the audit log, about 10 per second:
    Audit Event Details
    Timestamp 03/15/2011 04:37:05 PM MET
    Subject CONFIGURATOR
    Action Login
    Result Success
    Identity System Type User
    Object Name CONFIGURATOR
    Server DOESBURG.IC.UVA.NL
    Sequence Number No Value
    Interface BPE
    Resource No Value
    AccountId No Value
    Message No Value
    Changes No Value
    Organization Membership Top
    Event Parameters
    Session ID #SESS#15E4CCFDD2645B36:10C191A6:12EB99FCC85:-5A50
    Configurator logins on the BPE interface which we don't use?
    Has anyone seen something like this before? What could cause it?
    Greetings,
    Marijke

    I'm still struggling with this problem. Our database administrator did add some tracing, and we see these type of queries:
    SELECT tstamp, id, version, changeType FROM objchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT tstamp, id, version, changeType FROM objchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT task.id, task.type, name, :"SYS_B_0", :"SYS_B_1", summary, :"SYS_B_2", :"SYS_B_3", xmlSize, :"SYS_B_4"
    SELECT tstamp, id, version, changeType FROM objchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT object.id, object.type, name FROM object WHERE object.type=:"SYS_B_0"
    SELECT tstamp, id, version, changeType FROM orgchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT tstamp, id, version, changeType FROM objchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT tstamp, id, version, changeType FROM objchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT tstamp, id, version, changeType FROM objchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT tstamp, id, version, changeType FROM objchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT tstamp, id, version, changeType FROM objchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT tstamp, id, version, changeType FROM rolechange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    SELECT tstamp, id, version, changeType FROM objchange WHERE tstamp > :1 AND type=:2 ORDER BY tstamp
    541 seperate logon sessions by waveset in about 2 minutes.
    Has anyone seen this? What could cause it?
    Greetings,
    Marijke

  • Re: Java Database

    Hello,
    I'll like some advice on the topic mentioned above. I'm a beginner of java programming and have elementry knowledge about java. I'll like to know how is it possible to input the list of data in Excel format into Java Database Connectivity and how am I able to extract out the info. that I'll need. Like say the columns/field on designation and name. How am I able to extract the data and change it like to delete or edit the info.??
    Pls. explain it step-by-step your patience is really appreciated. Thanks and God Bless.

    You should search Javaworld for "Excel" - they've had a few articles about using JDBC to access Excel. As far as I recall, though, you can't alter data in Excel through JDBC, only read it.
    http://www.javaworld.com
    There are other ways of getting at Excel data through Java but they're not very good either (unless you want to use a Java-COM bridge).

  • [Bug] Or feature? Database connection closed if given a name after first op

    I am not sure if this is a bug or a feature.
    oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase("sample", conn);
    If I supply a name for the database as the above line using "sample", the database connection is closed after the first op, i.e., you can call
    db.listObjects once, but the second time, it will fail with StackOverFlowException. But the culprit is the database connection is closed after the first op.
    However, if I don't give it a name, using null,
    oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase(null, conn);
    There's no problem at all.
    Is this a bug or a feature?
    If a feature, the JavaDoc made it worse, by using the following example:
    http://www.oracle.com/technology/products/jdev/esdk/api1013/oracle/javatools/db/DatabaseFactory.html
    The DatabaseFactory should be used over the DBObjectProviderFactory when a Database specifically is required, and the name and Connection of that Database are available.
    e.g.
    java.sql.Connection conn = // the Connection to the db
    DatabaseFactory.findOrCreateDatabase( "ora10g", conn );
    The example sure sounds like a name is mandatory. Or perhaps the name is not some random name, but TNSName? If so, the Doc should certainly mention that.

    I am not sure if this is a bug or a feature.
    oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase("sample", conn);
    If I supply a name for the database as the above line using "sample", the database connection is closed after the first op, i.e., you can call
    db.listObjects once, but the second time, it will fail with StackOverFlowException. But the culprit is the database connection is closed after the first op.
    However, if I don't give it a name, using null,
    oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase(null, conn);
    There's no problem at all.
    Is this a bug or a feature?
    If a feature, the JavaDoc made it worse, by using the following example:
    http://www.oracle.com/technology/products/jdev/esdk/api1013/oracle/javatools/db/DatabaseFactory.html
    The DatabaseFactory should be used over the DBObjectProviderFactory when a Database specifically is required, and the name and Connection of that Database are available.
    e.g.
    java.sql.Connection conn = // the Connection to the db
    DatabaseFactory.findOrCreateDatabase( "ora10g", conn );
    The example sure sounds like a name is mandatory. Or perhaps the name is not some random name, but TNSName? If so, the Doc should certainly mention that.

  • Database Connections Not Closing

    I'm using iBatis for PostgreSQL database access and frequently have problems with connections not being closed. Here is a copy of my sqlMapConfig file:
    ============================
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE sqlMapConfig
    PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
    <sqlMapConfig>
    <properties resource="ibatis.properties" />
    <settings
    lazyLoadingEnabled="true"
    cacheModelsEnabled="true"
    enhancementEnabled="false"
    useStatementNamespaces="false"
    />
    <transactionManager type="JDBC" commitRequired="true">
    <dataSource type="DBCP">
    <property name="driverClassName" value="${driver}" />
    <property name="url" value="${url}" />
    <property name="username" value="${username}" />
    <property name="password" value="${password}" />
    <property name="maxActive" value="10"/>
    <property name="maxIdle" value="5"/>
    <property name="maxWait" value="5000"/>
    <property name="logAbandoned" value="true"/>
    <property name="removeAbandoned" value="true"/>
    <property name="removeAbandonedTimeout" value="1"/>
    <property name="Driver.logUnclosedConnections" value="true"/>
    </dataSource>
    </transactionManager>
    <sqlMap resource="job-sqlMap.xml" />
    </sqlMapConfig>
    ============================
    Due to the logAbandoned and removeAbandoned settings, I get a report in my log file whenever there is a connection that was not properly closed. Here is one of those log entries:
    23:22:51.483 (10) Finalizing a Connection that was never closed:
    java.lang.Throwable: Connection was created at this point:
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:175)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
    at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
    at org.postgresql.Driver.makeConnection(Driver.java:393)
    at org.postgresql.Driver.connect(Driver.java:267)
    at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
    at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
    at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:84)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:48)
    at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:89)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)
    at edu.calpoly.lib.multimedia.big.db.AutomaticPeriodUpdateIBatisImplDBHandler.getGamesWithAutomaticUpdatePolicy(AutomaticPeriodUpdateIBatisImplDBHandler.java:154)
    at edu.calpoly.lib.multimedia.big.game.AutoUpdateThread.run(AutoUpdateThread.java:155)
    The file: AutomaticPeriodUpdateIBatisImplDBHandler.java contains an iBatis call on line # 154:
    --> list = sqlMap.queryForList("getGamesWithAutoPolicy", null);
    from the map file:
    <select id="getGamesWithAutoPolicy" resultClass="java.util.HashMap">
    <![CDATA[
    SELECT gameid, policy
    FROM update_policy
    ]]>
    </select>
    Here is the code for the entire method that uses this transaction:
    ============================
    public List getGamesWithAutomaticUpdatePolicy() throws BIGDatabaseFacadeException
    List list = new ArrayList();
    try
    sqlMap.startTransaction();
    list = sqlMap.queryForList("getGamesWithAutoPolicy", null);
    sqlMap.commitTransaction();
    catch(SQLException sqle)
    throw new BIGDatabaseFacadeException(sqle);
    finally
    try
    sqlMap.endTransaction();
    catch(SQLException sqle)
    throw new BIGDatabaseFacadeException(sqle);
    return list;
    ============================
    I know that this should be handled as an automatic transaction, but I tried adding the start, commit and end transaction commands in my desperate attempt to fix this problem (but it still didn't help).
    Here is my code for creation of sqlMap -
    --> sqlMap = SqlMapClientBuilder.buildSqlMapClient(Resources.getResourceAsReader("sqlMaps.xml"));
    Except for the fact that occasionally connections are not closed, overall my database access using iBatis works very well.
    In the course of trying to fix this problem I've worked to update all my lib files to the latest versions, and here is current status:
    My iBatis lib file: ibatis-2.3.4.726.jar
    My JDBC driver: postgresql-8.4-701.jdbc3.jar
    Required commons files:
    commons-dbcp-1.2.2.jar
    commons-pool-1.5.3.jar
    Note that I tried adding --> commitRequired="true" to the transactionManager in sqlMaps.xml, hoping it might help, but no joy.
    Please help me figure out why my database connections often do not close. Thank you very much!

    I'm sorry, but I don't understand what you mean by "close the session." I believe iBatis is supposed to take care of all that automatically. My understanding is that all the user does is create the sqlMapClient and then use it along with various map files to query and update the database. iBatis does the rest.

Maybe you are looking for