Issue in setting up a connection pool in Glassfish

Hello,
I'm having an issue in setting up a connection pool in Glassfish. Previously I did it succesfully when I installed Glassfish in a Windows Server machine, but now I'm trying to do the same thing on a Linux machine and it's not working.
Glassfish version is: Glassfish server open source edition 3.1.1 (build 12)
The machine is a AWS machine running Amazon Linux AMI
Oracle Database is Oracle 11g Release 11.1.0.6.0 - 64bit Production With the Real Application Clusters option
The Oracle client installed on the machine is Release 11.2.0.3.0 Production
Java version is: Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
I've created the pool with the following options:
Resource Type: javax.sql.DataSource
Datasource classname: oracle.jdbc.pool.OracleDataSource
And as additional properties (apart from User and Password) I put as URL jdbc:oracle:oci8:@EVOREAD
The TNS file is correct and I can connect without any problem using sqlplus. I already copied the ojdbc6.jar in the /opt/Glassfish3/Glassfish/lib folder and I already restarted Glassfish server. Basically I did all the same steps that I did in the Windows machine, but in the Linux machine I always receive the following error:
java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.library.path no ocijdbc11 in java.library.path
I needed to create also a connection pool to a MySql Database and basically I did exactly the same steps (apart of course using all the parameters needed for MySql and the proper connector) and it worked immediately.
Anyone can help me?

You are using an OCI driver? You can either revert to using a thin client, or install the SQL client binaries and add its lib directory to the LD_LIBRARY_PATH.

Similar Messages

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

  • Unable to set-up sybase connection pool for wls6.1

    Hi All,
    I am trying to set-up sybase connection pool in wls6.1 using the supplied jConnect driver (don't know the version of the driver). In diff places I am seeing diff opinions about the settings. It is really frustrating because BEA doc shies away from documenting just the sybase details although it provides details about Oracle, informix and SQL Server.
    I just want to know these
    1. the xml string for the connection pool
    2. which config file should have it (web.xml or config.xml or something else?)
    thanks a ton in advance
    ~rakesh

    Hi,
    I've already solve the problem. I did the following:
    set the Url to be: jdbc:oracle:thin:@hostname:port:SID
    set username
    set password
    add oracle.jdbc.drivers.OracleDriver into the JVM options -Djdbc.drivers
    restart the server
    test the connection
    it works :)

  • Setting up a connection pool to ms sql database

    Hi
    I am trying to create a connection pool to talk to an MSSQL database, and could not manage to ping the DB (Operation 'pingConnectionPool' failed in 'resources' Config Mbean.) .
    What set of properties need to be included for connection pool to an MS SQL DB?
    your help is very much appreciated,
    Yhank you
    orms2004

    package coreservlets;
    import java.sql.*;
    import java.util.*;
    /** A class for preallocating, recycling, and managing
    *  JDBC connections.
    *  <P>
    *  Taken from Core Servlets and JavaServer Pages
    *  from Prentice Hall and Sun Microsystems Press,
    *  http://www.coreservlets.com/.
    *  &copy; 2000 Marty Hall; may be freely used or adapted.
    public class ConnectionPool implements Runnable {
      private String driver, url, username, password;
      private int maxConnections;
      private boolean waitIfBusy;
      private Vector availableConnections, busyConnections;
      private boolean connectionPending = false;
      public ConnectionPool(String driver, String url,
                            String username, String password,
                            int initialConnections,
                            int maxConnections,
                            boolean waitIfBusy)
          throws SQLException {
        this.driver = driver;
        this.url = url;
        this.username = username;
        this.password = password;
        this.maxConnections = maxConnections;
        this.waitIfBusy = waitIfBusy;
        if (initialConnections > maxConnections) {
          initialConnections = maxConnections;
        availableConnections = new Vector(initialConnections);
        busyConnections = new Vector();
        for(int i=0; i<initialConnections; i++) {
          availableConnections.addElement(makeNewConnection());
      public synchronized Connection getConnection()
          throws SQLException {
        if (!availableConnections.isEmpty()) {
          Connection existingConnection =
            (Connection)availableConnections.lastElement();
          int lastIndex = availableConnections.size() - 1;
          availableConnections.removeElementAt(lastIndex);
          // If connection on available list is closed (e.g.,
          // it timed out), then remove it from available list
          // and repeat the process of obtaining a connection.
          // Also wake up threads that were waiting for a
          // connection because maxConnection limit was reached.
          if (existingConnection.isClosed()) {
            notifyAll(); // Freed up a spot for anybody waiting
            return(getConnection());
          } else {
            busyConnections.addElement(existingConnection);
            return(existingConnection);
        } else {
          // Three possible cases:
          // 1) You haven't reached maxConnections limit. So
          //    establish one in the background if there isn't
          //    already one pending, then wait for
          //    the next available connection (whether or not
          //    it was the newly established one).
          // 2) You reached maxConnections limit and waitIfBusy
          //    flag is false. Throw SQLException in such a case.
          // 3) You reached maxConnections limit and waitIfBusy
          //    flag is true. Then do the same thing as in second
          //    part of step 1: wait for next available connection.
          if ((totalConnections() < maxConnections) &&
              !connectionPending) {
            makeBackgroundConnection();
          } else if (!waitIfBusy) {
            throw new SQLException("Connection limit reached");
          // Wait for either a new connection to be established
          // (if you called makeBackgroundConnection) or for
          // an existing connection to be freed up.
          try {
            wait();
          } catch(InterruptedException ie) {}
          // Someone freed up a connection, so try again.
          return(getConnection());
      // You can't just make a new connection in the foreground
      // when none are available, since this can take several
      // seconds with a slow network connection. Instead,
      // start a thread that establishes a new connection,
      // then wait. You get woken up either when the new connection
      // is established or if someone finishes with an existing
      // connection.
      private void makeBackgroundConnection() {
        connectionPending = true;
        try {
          Thread connectThread = new Thread(this);
          connectThread.start();
        } catch(OutOfMemoryError oome) {
          // Give up on new connection
      public void run() {
        try {
          Connection connection = makeNewConnection();
          synchronized(this) {
            availableConnections.addElement(connection);
            connectionPending = false;
            notifyAll();
        } catch(Exception e) { // SQLException or OutOfMemory
          // Give up on new connection and wait for existing one
          // to free up.
      // This explicitly makes a new connection. Called in
      // the foreground when initializing the ConnectionPool,
      // and called in the background when running.
      private Connection makeNewConnection()
          throws SQLException {
        try {
          // Load database driver if not already loaded
          Class.forName(driver);
          // Establish network connection to database
          Connection connection =
            DriverManager.getConnection(url, username, password);
          return(connection);
        } catch(ClassNotFoundException cnfe) {
          // Simplify try/catch blocks of people using this by
          // throwing only one exception type.
          throw new SQLException("Can't find class for driver: " +
                                 driver);
      public synchronized void free(Connection connection) {
        busyConnections.removeElement(connection);
        availableConnections.addElement(connection);
        // Wake up threads that are waiting for a connection
        notifyAll();
      public synchronized int totalConnections() {
        return(availableConnections.size() +
               busyConnections.size());
      /** Close all the connections. Use with caution:
       *  be sure no connections are in use before
       *  calling. Note that you are not <I>required</I> to
       *  call this when done with a ConnectionPool, since
       *  connections are guaranteed to be closed when
       *  garbage collected. But this method gives more control
       *  regarding when the connections are closed.
      public synchronized void closeAllConnections() {
        closeConnections(availableConnections);
        availableConnections = new Vector();
        closeConnections(busyConnections);
        busyConnections = new Vector();
      private void closeConnections(Vector connections) {
        try {
          for(int i=0; i<connections.size(); i++) {
            Connection connection =
              (Connection)connections.elementAt(i);
            if (!connection.isClosed()) {
              connection.close();
        } catch(SQLException sqle) {
          // Ignore errors; garbage collect anyhow
      public synchronized String toString() {
        String info =
          "ConnectionPool(" + url + "," + username + ")" +
          ", available=" + availableConnections.size() +
          ", busy=" + busyConnections.size() +
          ", max=" + maxConnections;
        return(info);
    }taken from:
    http://archive.coreservlets.com/Chapter18.html

  • Set up DB Connection Pool for Oracle DataBase Using Java App Server8

    Hi,
    In the Admin Console of Java App Server 8, I tried to create a connection pool for the oracle database. I chose Resource Type to be "javax.sql.ConnectionPoolDataSource" and the Vendor is Oracle. So the Data Source Class Name is filled by the system to be "oracle.jdbc.pool.OracleConnectionPoolDataSource". Now, I set up the class path to point to the database driver class "sun.jdbc.odbc.JdbcOdbcDriver" and also the to the Data Source Class Name. Also I set up the JVM options in the console. Restart the server, and then try to ping to the database, but get the error:
    Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target exception message: Connection could not be allocated because: No suitable driver
    I don't understand what else I should do and why this error is coming?
    Please help me out.
    Thank you
    Regards,
    Sarah

    Hi,
    I've already solve the problem. I did the following:
    set the Url to be: jdbc:oracle:thin:@hostname:port:SID
    set username
    set password
    add oracle.jdbc.drivers.OracleDriver into the JVM options -Djdbc.drivers
    restart the server
    test the connection
    it works :)

  • Setting roles on connection pools

    Hi,
    using OracleConnectionCacheImpl and OracleConnectionPoolDataSource,
    how can I set a role on the pooled connections since the creation of the physical
    connection is out of my hands ? Ideally, I would like to set the role only once
    so that when I call getConnection() to get the logical connection I do not have
    to set it again and again ...
    We are using exclusively stored procedures which one can execute according to its role.
    Typically, my client has a role and uses a well known ConnectionCache which should
    set the role accordingly.
    Is the only solution to set the role on each request ?
    I hope not.
    Is anybody using roles in their applications ?
    Cheers
    Arnaud

    Hi,
    using OracleConnectionCacheImpl and OracleConnectionPoolDataSource,
    how can I set a role on the pooled connections since the creation of the physical
    connection is out of my hands ? Ideally, I would like to set the role only once
    so that when I call getConnection() to get the logical connection I do not have
    to set it again and again ...
    We are using exclusively stored procedures which one can execute according to its role.
    Typically, my client has a role and uses a well known ConnectionCache which should
    set the role accordingly.
    Is the only solution to set the role on each request ?
    I hope not.
    Is anybody using roles in their applications ?
    Cheers
    Arnaud

  • Tomcat 5.5 + JDBC connection pooling -- help

    I recently upgraded from java 1.4/tomcat 5.0 to java 1.5/tomcat 5.5. I am having difficulty getting connection pooling to work, however.
    Here are the details:
    1. Using mysql 4.1.3 beta -- it has been working fine for my purposes for a while
    2. put mysql-connector-java-3.1.7-bin.jar in tomcat/common/lib.
    3. Here is server.xml:
    <Server port="8005" shutdown="SHUTDOWN">
        <GlobalNamingResources>
            <Resource auth="Container" name="jdbc/TestDB"
            type="javax.sql.DataSource"/>
            <ResourceParams name="jdbc/TestDB">
                <parameter>
                    <name>url</name>
                    <value>jdbc:mysql://localhost:3306/TestDB?autoReconnect=true</value>
                </parameter>
                <parameter>
                    <name>maxIdle</name>
                    <value>40</value>
                </parameter>
                <parameter>
                    <name>maxActive</name>
                    <value>150</value>
                </parameter>
                <parameter>
                    <name>driverClassName</name>
                    <value>com.mysql.jdbc.Driver</value>
                </parameter>
                <parameter>
                    <name>maxWait</name>
                    <value>3000</value>
                </parameter>
                <parameter>
                    <name>removeAbandoned</name>
                    <value>true</value>
                </parameter>
                <parameter>
                    <name>username</name>
                    <value>webapp</value>
                </parameter>
                <parameter>
                    <name>factory</name>
                    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                </parameter>
                <parameter>
                    <name>logAbandoned</name>
                    <value>true</value>
                </parameter>
                <parameter>
                    <name>removeAbandonedTimeout</name>
                    <value>90</value>
                </parameter>
                <parameter>
                    <name>password</name>
                    <value>secret</value>
                </parameter>
            </ResourceParams>
        </GlobalNamingResources>
        <Service name="Catalina">
            <Connector port="8080" />
            <Engine name="Catalina" defaultHost="localhost">
                <Host appBase="webapps"
                      autoDeploy="true"
                      debug="5"
                      liveDeploy="true"
                      name="localhost"
                      unpackWARs="true"
                      xmlValidation="true"/>
            </Engine>
        </Service>
    </Server>4. My application is called "bertle". Here is tomcat/conf/Catalina/localhost/bertle.xml:
    <Context path="/bertle" reloadable="true"
             docBase="C:\eclipse\workspace\bertle\bertle"
             workDir="C:\eclipse\workspace\bertle\work">
        <ResourceLink global="jdbc/TestDB"
                      name="jdbc/TestDB"
                      type="javax.sql.DataSource" />
    </Context>5. Tomcat starts up find without showing any errors. However, when I try and run the application I get an error. The error occurs when the user tries to log in, which involves querying the mysql database. Here is some of what it spits up:
    SEVERE: Error in validating user.
    Feb 28, 2005 5:05:16 PM edu.harvard.dsg.chv.model.LoginBean validateUser
    SEVERE: SQL statement =
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
         at  org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
         at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
         at mypackage.model.LoginBean.validateUser(LoginBean.java:49)
         at mypackage.action.LoginAction.execute(LoginAction.java:58)6. Here is the line at LoginBean.java:49:
    49    con = dataSource.getConnection();Here are the lines at LoginAction.java:58
    46        // Obtain our environment naming context
    47        Context initCtx = new InitialContext();
    48        Context envCtx = (Context) initCtx.lookup("java:comp/env");
    49       
    50        // Look up our data source
    51        DataSource ds = (DataSource) envCtx.lookup("jdbc/TestDB");
    52       
    53        // create a new LoginBean passing the datasource
    54        LoginBean lb = new LoginBean(ds);
    55       
    56        // check to see if this user/password combination are valid
    57        // will return a non-null UserDTO if valid
    58        UserDTO user = lb.validateUser((String)((DynaValidatorForm)form).get("handle"),
    59                (String)((DynaValidatorForm)form).get("password"));Is there something I am also supposed to add to WEB-INF/web.xml ?
    I am offering many kudos to anyone who can tell me what I am overlooking.
    Thanks,
    Jon

    the stuff you added in server.xml is old and wiilnot
    work with 5.5.*
    might pass dtd but it will not work
    did you try changing it to new layoutI gave you one Duke dollar for helping me with this.
    I will give another one to anyone who can tell me
    e how to set up global connection pooling in tomcat.Hi,
    Please bear with me for replying to a thread that's a week old.
    I was trying to set up connection pooling in tomcat and this thread helped me clear up some issues for the same.
    Incidentally google returns this thread among the top 10 when i search for tomcat 5.5 connection pooling.
    There are some unexplained questions here (regarding global connection pooling) and since I was able to set that up too, this may, in the future, benefit anybody who faces similar issues.
    Setting Up Global Connection Pooling
    Add this piece of code to server.xml under the server element
    <Server port="8005" shutdown="SHUTDOWN">
      <!-- other elements -->
      <GlobalNamingResources>
         <!-- other global resources-->
          <Resource name="jdbc/learning" auth="Container"                      type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
                         url="jdbc:oracle:thin:@localhost:1521:learning"
                         username="Learning" password="Learning" maxActive="20" maxIdle="10"  maxWait="-1"/>         
      </GlobalNamingResources>And then in your context file (which may be the <webapps>/<your appn>/META-INF/<your_web_app.xml> directory or conf/catalina/localhost/<your_web_app.xml>)
    add this code
    <Context docBase="${catalina.home}/webapps/webtest"
             privileged="true" antiResourceLocking="false" antiJARLocking="false">
    <!-- Use this if you dont require global resources
      <Resource name="jdbc/learning" auth="Container"
                         type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
                         url="jdbc:oracle:thin:@localhost:1521:learning"
                         username="Learning" password="Learning" maxActive="20" maxIdle="10"
                  maxWait="-1"/>
    -->
    <!-- this is a resource link if you have defined resource globally-->
    <ResourceLink
                name="jdbc/learning"
                global="jdbc/learning"
                type="javax.sql.DataSource"
              />
    </Context>also tomcat recommends defining the docBase outside the webapps directory (ie any other location outside the tomcat installation dir) if you choose to define contexts in xml files.
    thanks,
    ram.

  • Setting up Connection Pool in sun app server 8.1 with SQL server 2000

    Hello,
    I am trying to set up a connection pool & data source for SQL server 2000 (MSDE 2000).
    Here is what I attempted to do:
    I have a pool data source in a jar file called poll.jar and I copied it to C:\sun\Appserver\lib (Install dir\lib)
    com.microsoft.mspool.PoolDataSource is the pool data source class.
    In the Admin console, JDBC>Connection pools. Selected NEW and made the following entries.
    GENERAL SETTINGS
    Name: MsPool
    Datasource class name : com.microsoft.mspool.PoolDataSource
    Resource type: javax.sql.DataSource
    POOL SETTINGS: default values
    CONNECTION VALIDATION: default values
    TRANSACTION ISOLATION: default values
    PROPERTIES:
    DataSourceName:PoolDataSource
    NetworkProtocol:tcp
    DatabaseName: myDB
    Password:User specific
    user:User specific
    server: localhost
    PortNumber:1433
    I get the following error when I ping:
    Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target exception message: Class name is wrong or classpath is not set for : com.microsoft.mspool.PoolDataSource.
    Can any one help me if have a solution?
    Thanks in advance.
    mag

    You need to copy your jar to ${AS_INSTALL}/domains/domain1/lib/ext (replace domain1 by your
    domain). Another option is to leave the jar in ${AS_INSTALL}/lib and add a entry in the classpath-suffix element of your domain.xml.
    thanks,
    :aditya

  • Setting up connection pool in MSSQL SERVER 2000

    hi,
    i m having too much trouble in setting up connection pool in TOMCAT 5.0.25 for MS SQL SERVER 2000...
    ......so plz guide me how to do that...
    TIA
    bhups

    i m having too much trouble in setting up connection
    pool in TOMCAT 5.0.25 for MS SQL SERVER 2000...Never done it for SQL Server, but setting up a connection pool in tomcat is basically the same no matter what DB you're using:
    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    The two files you're interested in are server.xml and web.xml. You just need to look at the MYSQL and Oracle examples and "tweak" it ...

  • Setting up connection pool for cloudscape 10 embedded database

    I got problem with setting connection pool via admin console for cloudscape 10 embedded in j2ee 1.4 (Application server 8.1), what im doing is:
    -in resources/jdbc/ConnectionPools i add a new pool
    - datasource classname i set up as: "org.apache.derby.jdbc.EmbeddedXADataSource"
    -resource type: "javax.sql.XADataSource"
    -DatabaseName: "jdbc:derby:D:\\Programowanie\J2EE\domains\domain1\config\notesData"
    -set no password and user, becouse i havet set this in database
    and when i ping to that datebase i got error:"Operation 'pingConnectionPool' failed in 'resources' Config Mbean."
    when i change Datasource Classname to: "org.apache.derby.jdbc.EmbeddedDataSource", this error occur:
    Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target exception message: Connection object cannot be null
    what im doing wrong? i look everywhere and i cant find solution to my problem...hope you can help me.
    Thanks,
    Krystian

    Amit wrote:
    >
    "whats are the settings (URL, driver, properties) required to set up a connection pool for DB2 on OS/390 ?I'm using "COM.ibm.db2.jdbc.app.DB2Driver" as DB2 driverHi. If you can successfully use that driver with one of it's simple
    JDBC example programs, then show me that example, at least the
    part that makes the connection, and I'll show you how to define a pool.
    Joe
    PS: Folks: BEA WebLogic is expanding rapidly, with both entry and advanced positions
    for people who want to work with Java, XML, SOAP and E-Commerce infrastructure products.
    We have jobs at Nashua NH, Liberty Corner NJ, San Francisco and San Jose CA.
    Send resumes to [email protected]

  • Setting up connection pool for DB2

    "whats are the settings (URL, driver, properties) required to set up a connection pool for DB2 on OS/390 ?I'm using "COM.ibm.db2.jdbc.app.DB2Driver" as DB2 driver

    Amit wrote:
    >
    "whats are the settings (URL, driver, properties) required to set up a connection pool for DB2 on OS/390 ?I'm using "COM.ibm.db2.jdbc.app.DB2Driver" as DB2 driverHi. If you can successfully use that driver with one of it's simple
    JDBC example programs, then show me that example, at least the
    part that makes the connection, and I'll show you how to define a pool.
    Joe
    PS: Folks: BEA WebLogic is expanding rapidly, with both entry and advanced positions
    for people who want to work with Java, XML, SOAP and E-Commerce infrastructure products.
    We have jobs at Nashua NH, Liberty Corner NJ, San Francisco and San Jose CA.
    Send resumes to [email protected]

  • Can admin.jar create oc4j users and connection pools that use those users

    Hi
    I have an ADF BC application written in jdev 10.1.3.3 deployed to standalone oc4j 10.1.3
    When I deploy the application I use the enterprise manager to create the users on the security provider/realms tab. I then set up the connection pools in jdbc resources to use those users via the username and indirect password fields. I also set the minimum number of connections on the attributes tab.
    I have read the following document but I cannot find any reference to setting up users, connection pools with indirect passwords or minimum number of connections.
    http://download-uk.oracle.com/docs/cd/B31017_01/web.1013/b28950/adminclient.htm#BABHJAFE
    Is it possible to do using admin.jar?
    thanks
    paul schweiger

    I'm not sure about setting indirect passwords on the connection pool creation -- never tried it. It's probably treated purely as a lexical string, so may well be able to to issue the CP creation command with the "->USER" entry as the password.
    To create realms, users, groups, etc. you need to use the $ORACLE_HOME/j2ee/home/jazn.jar utility: http://download.oracle.com/docs/cd/B25221_04/web.1013/b14429/admintool.htm#g1022417
    The options for connection pool parameters such as min/max connections aren't directly expressable in the command. I'll need to look at the code and see if they can be passed in as non checked options via the factoryproperties. If not, then you can create a JMX client to use the MBeans that are created for the CP post deployment to change its behaviour.
    -steve-

  • Connection pool not re-establishing connections, throwing exception instead

    Hello,
    I've just set up a connection pool on the sun java system application server 8 for a MySQL database using the official mysql-connector/j 5.0. Everything is working great, except when the connections timeout (or i kill them all manually from the database server) and then request a page that needs to use the DataSource object, the following exception is thrown:
    Exception thrown: com.mysql.jdbc.CommunicationsException -- Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.io.EOFException
    STACKTRACE:
    java.io.EOFException
         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1913)
         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2304)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2803)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3118)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3047)
         at com.mysql.jdbc.Statement.executeQuery(Statement.java:1166)
         at com.mysql.jdbc.jdbc2.optional.StatementWrapper.executeQuery(StatementWrapper.java:705)
         at beans.MySessionBean.businessMethod(MySessionBean.java:73)
         at org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.What could be wrong?
    Thank you.

    The code is here:
        public String businessMethod() {
            //TODO implement businessMethod
            try
                InitialContext ic = new InitialContext();
                Object obj = ic.lookup("jdbc/MyDS");
                System.out.println("Object is: " + obj + " | Class is: " + obj.getClass().getName());
                DataSource ds = (DataSource)obj;
                Connection conn = ds.getConnection();
                Statement stmt = conn.createStatement();
                ResultSet rs = stmt.executeQuery("SELECT a,b FROM test");
                String ret = "";
                while(rs.next())
                    ret += rs.getString(1) + " - " + rs.getString(2) + "<br/>";
                conn.close();
                return ret;
            catch(Exception e)
                return "Exception thrown: " + e.getClass().getName() + " -- " + e.getMessage();
        }On the server, it is set up as XADataSource. I don't really have a big need for distributed transactions, but does it hurt badly to use it anyways? Could it be causing this problem?

  • How to catch exception when have max connection pool

    hi,
    i have define in oracle user that i could have max 10 sessions at the same time.
    I have jdbc datasource & connection pool defined at glassfish server(JSF application).
    now, if in application is too many queries to the database then i have error: nullpointer exception - becouse when i try to do:
    con = Database.createConnection(); - it generates nullpointer exception becouse there isn't free connection pool
    i try to catch exception like this:
    public List getrep_dws_wnioski_wstrzymane_graph() {     int i = 0;     try {     con = Database.createConnection();     ps =    (Statement) con.createStatement();     rs = ps.executeQuery("select data, klasa, ile_dni_wstrzymana, ile_wnioskow from stg1230.dwsww_wstrzymane_dws8 order by data, klasa, ile_dni_wstrzymana, ile_wnioskow");     while(rs.next()){       rep_dws_wnioski_wstrzymane_graph.add(i,new get_rep_dws_wnioski_wstrzymane_graph(rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4)));       i++;     }     } catch (NamingException e) {         e.printStackTrace();     } catch (SQLException e) {         e.printStackTrace();     } catch (NullPointerException e) {         e.printStackTrace();         throw new NoConnectionException();  // catch null 1     } finally {     try {         con.close();     } catch (SQLException e) {         e.printStackTrace();     } catch (NullPointerException e) {         e.printStackTrace();         throw new NoConnectionException();  // catch null 2     }     } return rep_dws_wnioski_wstrzymane_graph; }
    but at line:
    con.close();
    i have nullpointerexception
    and
    at line
    throw new NoConnectionException(); // catch null 2
    i have: caused by exception.NoConnectionException
    what's wrong with my exception class? how to resolve it?
    public class NoConnectionException extends RuntimeException{     public NoConnectionException(String msg, Throwable cause){       super(msg, cause);     }     public NoConnectionException(){       super();     } }
    at web.xml i have defined:
    <error-page>         <exception-type>exception.NoConnectionException</exception-type>         <location>/NoConnectionExceptionPage.jsp</location>     </error-page>

    thanks,
    i did it and i have error:
    java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit
    at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:115)
    at logic.Database.createConnection(Database.java:37): conn = ds.getConnection();
    public class Database {
         public static Connection createConnection() throws NamingException,
                    SQLException {
                Connection conn = null;
                try{
                    Context ctx = new InitialContext();
              if (ctx == null) {
                   throw new NamingException("No initial context");
              DataSource ds = (DataSource) ctx.lookup("jdbc/OracleReports");
              if (ds == null) {
                   throw new NamingException("No data source");
              conn = ds.getConnection();  // here's exception when max connections to database
              if (conn == null) {
                   throw new SQLException("No database connection");
                } catch (NamingException e) {
                    e.printStackTrace();
                    throw new NoConnectionException(); 
             } catch (SQLException e) {
                 e.printStackTrace();
                    throw new NoConnectionException(); 
                catch (NullPointerException e) {
                 e.printStackTrace();
                    throw new NoConnectionException();  // obsluga bledy na wypadek jesli braknie wolnych polaczen do bazy
            return conn;
    }and at my ealier code i have error:
    at logic.GetDataOracle.getrep_dws_wnioski_wstrzymane_graph(GetDataOracle.java:192)
    at line: con = Database.createConnection();
    in code:
    public List getrep_dws_wnioski_wstrzymane_graph() {
        int i = 0;
        try {
        con = Database.createConnection();
        ps =    (Statement) con.createStatement();
        rs = ps.executeQuery("select data, klasa, ile_dni_wstrzymana, ile_wnioskow from stg1230.dwsww_wstrzymane_dws8 order by data, klasa, ile_dni_wstrzymana, ile_wnioskow");
        while(rs.next()){
          rep_dws_wnioski_wstrzymane_graph.add(i,new get_rep_dws_wnioski_wstrzymane_graph(rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4)));
          i++;
        } catch (NamingException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (NullPointerException e) {
            e.printStackTrace();
            throw new NoConnectionException();
        } finally {
        try {
            if(con != null)
            con.close();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (NullPointerException e) {
            e.printStackTrace();
            throw new NoConnectionException(); 
    return rep_dws_wnioski_wstrzymane_graph;
    }so what's wrong?
    i have limit max sessions 10 at oracle so i set at my connection pool 5 connections as max. But when i get max 5 sesssins and try to execute next query then i can't catch exception..

  • Oc4j connection pool: too much INACTIVE connections

    I am publishing an application - developed using Eclipse and previously published in Tomcat (where it works perfectly for a long time) - within corporate servers using Oc4j version 10.1.3. The database server is Oracle 9g.
    After the deployment operation, the application seems to work, but that happens during the work by users, there are still many connections whith status "INACTIVE", until to complete all the available connections.
    The datasource is set as follows:
    <connection-pool name="ConnectionPoolRichiestaPubblicazione">
    <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource"
    user="REDAZIONE"
    password="password"
    url="jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)
         (ADDRESS_LIST=(LOAD_BALANCE=ON)
         (ADDRESS=(PROTOCOL=TCP)
         (HOST=10.146.2.86)(PORT=1521))
         (ADDRESS=(PROTOCOL=TCP)(HOST=10.146.2.86)(PORT=1521)))
         (CONNECT_DATA=
    (SERVER=DEDICATED)
    (SERVICE_NAME=XE)
    (FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=180)(DELAY=5))))">
    </connection-factory>
    </connection-pool>
    <managed-data-source
    jndi-name="jdbc/RichiestaPubblicazioneDS"
    name="RichiestaPubblicazioneDS"
    connection-pool-name="ConnectionPoolRichiestaPubblicazione" />
    The java code to establish a connection is as follows:
    private Connection creaConnessioneDataSource(String nomedatasource) throws ConnessioneException{
              LOGGER.debug("START");
              try {
                   InitialContext context = new InitialContext();
                   DataSource ds = (DataSource)context.lookup(nomedatasource);
                   LOGGER.debug("URL DATASOURCE : " + ds.getConnection().getMetaData().getURL());
                   LOGGER.debug("USERNAME : " + ds.getConnection().getMetaData().getUserName());
                   this.conn = ds.getConnection();
              catch( Exception e ) {
                   LOGGER.error("Errore nella connessione tramite datasource : " + StringUtils.getCustomStackTrace(e));
              LOGGER.debug("END");
              return this.conn;
    Connections and statements are closed using the following methods:
         public boolean chiudi(Connection conn){
              LOGGER.debug("START");
              boolean esito = false;
              if (conn != null){
                   try {
                        conn.close();
                        esito = true;
                        LOGGER.debug("Connessione chiusa");
                   catch (SQLException e) {
                        LOGGER.error("Eccezione nella chiusura della connessione : " + e);
              LOGGER.debug("END");
              return esito;
         public boolean chiudi(Statement stmt){
              LOGGER.debug("START");
              boolean esito = false;
              if (stmt != null){
                   try {
                        stmt.close();
                        esito = true;
                        LOGGER.debug("Statement chiuso");
                   } catch (SQLException e) {
                        LOGGER.error("Eccezione nella chiusura dello statement : " + e);
                        e.printStackTrace();
              LOGGER.debug("END");
              return esito;
    Here are a couple of examples of code that interact with the database:
         public List<StatoRichiestaSintesi> getElencoStatiRichieste() throws ConnessioneException{
              LOGGER.debug("START");
              List<StatoRichiestaSintesi> listaStati=new LinkedList<StatoRichiestaSintesi>();
              LOGGER.debug("Apriamo connessione e statement");
              Connection conn = databaseManager.creaConnessioneDataSource(datasource);
              Statement stmt = databaseManager.creaStatement(conn, false);
              String sql="SELECT * FROM STATORICHIESTA";
              try {
                   ResultSet rs = stmt.executeQuery(sql);
                   while(rs.next()){
                        StatoRichiestaSintesi temp=new StatoRichiestaSintesi();
                        temp.setIdStato(rs.getString(1));
                        temp.setDescrizioneStato(rs.getString(2));
                        listaStati.add(temp);
                   LOGGER.debug("Numero record trovati : " + listaStati.size());
              } catch (SQLException e) {
                   LOGGER.error("Eccezione di tipo SQL : " + StringUtils.getCustomStackTrace(e));
              finally{
                   LOGGER.debug("Chiusura di statement e connessione");
                   databaseManager.chiudi(stmt);
                   databaseManager.chiudi(conn);
              LOGGER.debug("END");
              return listaStati;
    Below is another example using PreparedStatement:
         private synchronized void aggiungiIndicazioneProgetto(String idprogetto, String idrichiesta) {
              LOGGER.debug("START");
              LOGGER.debug("Creo un oggetto di tipo connessione");
              Connection conn = databaseManager.creaConnessioneDataSource(datasource);
              LOGGER.debug("Definisco una query sql");
              String sql = "INSERT INTO RICHIESTAPROGETTO (IDRICHIESTA,IDPROGETTO) VALUES (?,?)";
              LOGGER.debug("Dichiaro un oggetto di tipo preparedstatement");
              PreparedStatement stmt = null;
              try {
                   LOGGER.debug("Istanzio l'oggetto statement");
                   stmt = conn.prepareStatement(sql);
                   LOGGER.debug("Imposto i segnalibri della query");
                   stmt.setString(1, idrichiesta);
                   stmt.setString(2, idprogetto);
                   LOGGER.debug("Eseguo la query di inserimento del progetto");
                   stmt.executeUpdate();
              } catch (SQLException e) {
                   LOGGER.error("Eccezione di tipo SQL : " + StringUtils.getCustomStackTrace(e));
              finally {
                   LOGGER.debug("Chiusura di statement e connessione");
                   databaseManager.chiudi(stmt);
                   databaseManager.chiudi(conn);
              LOGGER.debug("END");
         Which may be the cause for the described behavior?
         I hope someone help me..

    My problem is the following.
    If I deploy my application with the illustred datasource in my local OC4J (10.1.3 in a Standalone Environment) all work fine.
    The application creates a reasonable number of connections (in ORACLE - 10g Enterprise Edition Release 10.2.0.4.0 - db I run the query verification "select count(*) from v$session where username='MYAPPLICATION'"), and overall performance is very good.
    If, however, to deploy on the production machine of corporate (always 10.1.3, but obviously in Oracle Application Server Environment) the
    number of connections (status 'INACTIVE') grows massively, and this is saturated in a short time.
    The exception that at the end from the application is that:
    java.sql.SQLException: ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Linux Error: 2: No such file or directory
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
    oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
    oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:277)
    oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
    oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:243)
    oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:304)
    oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:430)
    oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)
    oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:608)
    oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:218)
    oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:114)
    oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:77)
    oracle.jdbc.pool.OracleImplicitConnectionCache.makeCacheConnection(OracleImplicitConnectionCache.java:1361)
    oracle.jdbc.pool.OracleImplicitConnectionCache.getCacheConnection(OracleImplicitConnectionCache.java:441)
    oracle.jdbc.pool.OracleImplicitConnectionCache.getConnection(OracleImplicitConnectionCache.java:336)
    oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:286)
    oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:179)
    oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:159)
    oracle.oc4j.sql.DataSourceConnectionPoolDataSource.getPooledConnection(DataSourceConnectionPoolDataSource.java:57)
    oracle.oc4j.sql.xa.EmulatedXADataSource.getXAConnection(EmulatedXADataSource.java:92)
    oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createXAConnection(ManagedConnectionFactoryImpl.java:211)
    oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:170)
    com.evermind.server.connector.ApplicationConnectionManager.createManagedConnection(ApplicationConnectionManager.java:1377)
    oracle.j2ee.connector.ConnectionPoolImpl.createManagedConnectionFromFactory(ConnectionPoolImpl.java:327)
    oracle.j2ee.connector.ConnectionPoolImpl.access$800(ConnectionPoolImpl.java:98)
    also I add the other attributes of Connection Pool of the Datasource:
    Connections:
    Initial size of Connection Cache = 0     
    Minimum Number of Connections = 0
    Maximum Number of Connections = -1
    Connection Retry Interval (seconds) = 1
    Maximum Connection Attempts = 3
    Maximum Number of Statements Cached = 0     
    Lower Threshold Limit On Pool (%)= 20     
    Validate Connection = False
    What I can do?
    many thanks..

Maybe you are looking for

  • IMac to tv with hdmi short circuit

    I have my iMac (Intel) connected to my Sony tv with an hdmi adapter.  It works fine except that sometimes the iMac seems to short circuit and turn off.  I read once that my cable may not be appropriate but then I lost that info.  Can anyone help?

  • Report Admin - Print Preview Error

    In reports admin, I get the following error when I select print preview:error marshalling arguments; nested exception is; java.net.SocketException; Socket write failed.Any ideas?

  • PI 7.1 EHP 1 Installation Error

    Dear All , I am installing PI 7.1 EHP 1 installation . I am getting the error in the task 29 : An error occurred while processing option SAP EHP1 for SAP NetWeaver Process Integration 7.1 > Installation Options > SAP Systems with Oracle > Standard Sy

  • Server requires authentication - How do I program for this?

    Hello, I'm testing out a webpage I have created that will be used to send email. I have DSL service...just recently subscribed. Previously I had Dial up. The server at that time didn't require authentication, but now that I have DSL it does. I'm a bi

  • MacBook and Windows

    Hey, I have been browsing the forums, particularly this section for quite a while now. Some information has been useful, but I kind-of need some specific advice now. I've been a Windows user since May this year when I got the new 2.4GHz MacBook. Mac