How to Create a connection pool in OSB java callout

Dear Team,
In our project, we need read some data from DB, and do corresponding operation. currently, we need setup the connection first, execute the SQL, and close the connection.
But the concurrency of call is very high, is there a way to create a connection pool, then we can use the connection pool to get the connection and execute the SQL, then return the connection to the pool.
if connection pool is not available, is there any way to create the connection outside the java callout, that we can just execute the SQL in java callout.
The OSB version is 11.1.1.6.0
Thanks.
Best Regards,
Raysen Jia
Edited by: Raysen Jia on Oct 16, 2012 8:44 AM

Hi Team,
Thanks for your help.
What I need is not only the db connection, may be other kind of things, such as read configuration from file...
If I write the code in java callout with static java method to create and close the connection, each time when request come in, OSB will create a new connection (or read the file), I think it's not the best practice to do this kind of work.
I think the weblogic is running in JVM, is there any way we can define variables or new object in the JVM directly?

Similar Messages

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

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

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

  • How to create the connection pool using jdbc20 driver?

    Hi all,
    My configuration is WL4.5 SP5 + jdk1.2.2+WinNT+ Oracle thin driver
    8.1.6.
    It is creating the connections with weblogic.jdbc.pool.Driver, whereas i
    want the connections in the pool to be created with jdbc20 driver. This
    how my pool definition is defined.
    weblogic.jdbc.connectionPool.PoolName=\
    url=jdbc:oracle:thin:@<IP address>:<Instance>,\
    driver=oracle.jdbc.driver.OracleDriver,\
    loginDelaySecs=1,\
    initialCapacity=1,\
    maxCapacity=40,\
    capacityIncrement=2,\
    allowShrinking=true,\
    shrinkPeriodMins=5,\
    refreshMinutes=10,\
    testTable=dual,\
    props=user=XXXX;password=XXXX
    The reason is I want to use BLOB's. I have a message posted in jdbc news
    group with the exception i got. But since this more of a environement
    issue i am posting it here.
    Any help is appreciated,
    Thanks
    John

    Here is the correct pool definition.
    ################JDBC20 Driver#########################
    weblogic.jdbc.connectionPool.jdbc20Pool=\
    url=jdbc20:weblogic:oracle,\
    driver=weblogic.jdbc20.oci.Driver,\
    loginDelaySecs=1,\
    initialCapacity=1,\
    maxCapacity=1,\
    capacityIncrement=2,\
    allowShrinking=true,\
    shrinkPeriodMins=15,\
    refreshMinutes=10,\
    testTable=dual,\
    props=user=SCOTT;password=tiger;server=goldengate
    weblogic.allow.reserve.weblogic.jdbc.connectionPool.jdbc20Pool=guest
    Hope this helps,
    --Kumar
    Kuppuswamy Seshadhri wrote:
    I think you are missing the port number.
    A working example,
    Ensuring
    - TSNAMES is setup and the service is running
    - set ORACLE_HOME variable in setenv.cmd
    weblogic.jdbc.connectionPool.theOraclePool=\
    url=jdbc:oracle:thin:@IPADRESS:1521:orcl,\
    driver=oracle.jdbc.driver.OracleDriver,\
    loginDelaySecs=1,\
    initialCapacity=1,\
    maxCapacity=10,\
    capacityIncrement=2,\
    allowShrinking=true,\
    shrinkPeriodMins=15,\
    refreshMinutes=10,\
    testTable=dual,\
    props=user=XXXX;password=XXXX;
    weblogic.allow.reserve.weblogic.jdbc.connectionPool.theOraclePool=everyone
    Kuppu
    "John Galt" <[email protected]> wrote in message
    news:[email protected]..
    Hi all,
    My configuration is WL4.5 SP5 + jdk1.2.2+WinNT+ Oracle thin driver
    8.1.6.
    It is creating the connections with weblogic.jdbc.pool.Driver, whereas i
    want the connections in the pool to be created with jdbc20 driver. This
    how my pool definition is defined.
    weblogic.jdbc.connectionPool.PoolName=\
    url=jdbc:oracle:thin:@<IP address>:<Instance>,\
    driver=oracle.jdbc.driver.OracleDriver,\
    loginDelaySecs=1,\
    initialCapacity=1,\
    maxCapacity=40,\
    capacityIncrement=2,\
    allowShrinking=true,\
    shrinkPeriodMins=5,\
    refreshMinutes=10,\
    testTable=dual,\
    props=user=XXXX;password=XXXX
    The reason is I want to use BLOB's. I have a message posted in jdbc news
    group with the exception i got. But since this more of a environement
    issue i am posting it here.
    Any help is appreciated,
    Thanks
    John

  • How to create datasource/connection pool programatically?

    Hello,
    We are developing a system that connects to multiple databases by dynamically switching datasources, using ADF 12.1.3. Application is deployed on weblogic and glassfish.
    There is no problem on switching and working on multiple datasources which is created previously on the application server (weblogic/glassfish).
    Now we need to create a datasource while system is running.
    Is it possible to create datasource programatically, and list datasource previously created?
    Jdeveloper/ADF: 12.1.3.
    Thanks,
    Ganbat Bayarbaatar.

    Dear Ashish,
    Thank you for your response, but that is not what I was looking for.
    I haven't any problem on changing datasources. I would like to create new datasource on application server.
    On Andrejus's post, there is a comment about what I'm asking:
    Syed : Nice Post. To enhace this more further. How can we get list of JDBC Data sources available in weblogic in the ADF Application.
    Andrejus: By using WebLogic API this should be possible or by accessing MBean...
    Is there any more-detailed blog post or doc, about "Weblogic API", "MBean"  and using them to create datasource?
    Thanks,
    Ganbat.

  • Error: Creating a Connection Pool: issue with valid transaction levels

    Server: SunOS 5.8 Generic_117350-27 sun4u sparc SUNW,UltraAX-MP
    App Server: Sun Java System Application Server 8.2
    Jar: ojdbc14.jar
    Datasource Classname: oracle.jdbc.pool.OracleConnectionPoolDataSource
    Resource Type: javax.sql.ConnectionPoolDataSource
    [Issue]
    Using /SUNWappserver/lib/ojdbc14.jar, when I create my connection pool in Sun Java System Application Server 8.2, I return the following error each time I try to start the domain:
    [#|2006-07-28T14:53:56.169-0500|WARNING|sun-appserver-pe8.2|javax.enterprise.resource.resourceadapter|_ThreadID=11;|RAR5117 : Failed to obtain/create connection. Reason : The isolation level could not be set: READ_COMMITTED and SERIALIZABLE are the only valid transaction levels|#]
    When I change the value to "SERIALIZABLE" in my domain.xml file, I receive the following error in my server.log:
    Caused by: org.xml.sax.SAXParseException: Attribute "transaction-isolation-level" with value "SERIALIZABLE" must have a value from the list "read-uncommitted read-committed repeatable-read serializable ".
    So, I'm stuck!
    I can't use the values READ_COMMITTED or SERIALIZABLE since the valid values are "read-uncommitted read-committed repeatable-read serializable ".
    Case sensitivity matters.
    Any thoughts or help would be greatly appreciated.
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    The Oracle JDBC accepts TRANSACTION_READ_COMMITTED and TRANSACTION_SERIALIZABLE isolation levels.
    Example:
    connAttr.setProperty(“TRANSACTION_ISOLATION”, “TRANSACTION_SERIALIZABLE”);
    I'd check with the Apps server folks.
    Kuassi - blog http://db360.blogspot.com/
    ------ book http://www.amazon.com/gp/product/1555583296/

  • Create A Connection Pool In the ServletContextListener

    The Specification says that we should create the connection pool in the ServletContextListener. I have the code for creating a connection pool (see below). How do I create it in the ServletContextListener?
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    public class DBConnection
       public static Connection getDBConnection() throws SQLException
          Connection conn = null;
          try
             InitialContext ctx = new InitialContext();
             DataSource ds = ( DataSource ) ctx.lookup( "java:comp/env/jdbc/MySQLDB" );
             try
                conn = ds.getConnection();
             catch( SQLException e )
                System.out.println( "Open connection failure: " + e.getMessage() );
          catch( NamingException nEx )
             nEx.printStackTrace();
          return conn;

    I use the connection pool feature provide by the server I use. Is this what I should do? Please confirm.
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    import javax.servlet.*;
    public class CreateResources implements javax.servlet.ServletContextListener
         public void contextInitialized(ServletContextEvent sce)
              public static Connection getDBConnection() throws SQLException
                   Connection conn = null;
                   try
                        InitialContext ctx = new InitialContext();
                        DataSource ds = ( DataSource ) ctx.lookup( "java:comp/env/jdbc/MySQLDB" );
                        try
                             conn = ds.getConnection();
                        catch( SQLException e )
                             System.out.println( "Open connection failure: " + e.getMessage() );
                  catch( NamingException nEx )
                        nEx.printStackTrace();
                  return conn;
         public void contextDestroyed(ServletCotnextEvent sce)
    }

  • How to use JDBC Connection Pools in a standalone application?

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

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

  • How do i use Connection pool in JSP pages

    Hey everyone,
    I am using a connection pool in my web application. I am using DbConnectionBroker from Javaexchange.com. It has a class that creates a connection pool available for the servlets. I am trying to figure out that how to use connection pool within the JSP pages if I want to connect to the database. In the servlets i am using DBConnectionBroker pool = (DbConnectionBroker) getServletContext().getAttribute("dbPool") to get database connection. How Can i use this in JSP page to get a db connection.
    Thanks

    If the reference to the connection pool is already stored as an ServletContex attribute, try:
    <jsp:useBean id="dbPool" scope="application" class="com.javaexchange.dbConnectionBroker" />
    <%
    Connection con = dbPool.getConnection();
    %>

  • HOW DB POOLING WORK AND HOW TO CREATA A DB POOLING IN JSP

    HI! I'm new in programming JSP and in web programming. I would like to learn how does the DB pooling work and how to create a DB Pooling. THANKS....

    Thanks for the idea but i need a more detail one...
    Hi,
    Db connections are one of the most expensive
    operations in an application.So at applicatin launch
    only multiple connections to the dbase are opened and
    used and returned/closed after usage.
    You can have a loop running 10 times creating a
    connection every time and putting those in a
    Collection object (say hashtable) marked with a key.
    Then in the application code , take an available
    connection from the hashtable and use it . After use
    return /close the connection (your pool can be
    incremental..creating 5 connections evey 10-15
    minutes).

  • How can I implement the connection pool in my java stored procedure

    my java stored procedures (in database 'B') have to connect to another oracle database ,let's say 'A'. And how can I implement the behavior like the so-called connection pool in my java stored procedure in 'B', as below.
    1. database B, has 2 java stored procedures sp1 and sp2
    2. both sp1 and sp2 connects to databse 'A'
    whatever I call the sp1 and sp2 and the database 'A' always only one connected session from sp1 and sp2 in database 'B'.
    THANKS A LOTS...

    my problem is I have a lots of java stored procedures need to cnnect to the remote oracle db, and I hope the remote db can only have a connected session from my java stored procedures in my local db. I try as below
    class sp{
    static Connection conn=null; //the remote db connection,
    public static void sp1(){...}//procedure 1, using conn
    public static void sp2(){...}//procedure 2, using conn,too
    I can 'see' the 'conn' variable if I invoke the sp1() and sp2() from the same client application(maybe sqlplus). But if I invoke the sp1() from client 'A' and invoke sp2() from client 'B' then the sp1() and sp2() can not see the 'conn' variable for each other. I think it's because the two clients cause oracle to create two instances of the class 'sp' and the sp1() and sp2() located in different instance seperately. Thus the sp1() and sp2() can not see 'conn' for each other. They can only see its own 'conn'.
    To connect to the remote db from the java stored procedure is easy but is it possible to connect to the remote db via database link from the java stored procedure at my local db ? If so, then I also archive my goal .
    BTW , thanks a lots...
    andrew :-)

  • How to create a connection to LDAP ?

    Hi ,
    I have a problem when config connection from ODI to LDAP.
    These are my configuration
    JDBC Driver
    com.sunopsis.ldap.jdbc.driver.SnpsLdapDriver
    JDBC URL
    jdbc:snps:ldap?ldap_url=ldap://x.x.x.x:389/&ldap_password=JLLMKAJHGFHLDHDFDDGPGPDB&ldap_basedn=cn=users,dc=cmg,dc=co,dc=th
    user : cn=users,dc=cmg,dc=co,dc=th
    password :
    command to encoded pass
    C:\>java -cp c:\orahome_1\oracledi\drivers\snpsldapo.jar com.sunopsis.ldap.jdbc.
    driver.SnpsLdapEncoder cmg123
    My purpose is :
    I need to query some a user table from LDAP and store it into MSSQL
    Thank you in advance.
    Somchai O.

    pl don't cross post ...
    try http://www.weblogic.com/docs51/admindocs/ldap.html
    Srikant, [email protected], http://weblogic.bea.com/, etc.
    Ron Reinhart wrote:
    I'm looking for information on creating a connection pool for LDAP.
    I have a reference to a good article on creating an ObjectPool by Thomas
    E. Davis,
    http://www.javaworld.com/javaworld/jw-06-1998/f_jw-06-object-pool.html,
    and used it to build an ldap implementation. How can I apply this to
    create a connection pool within Weblogic?
    Thanks

  • Error in creating a connection pool (No suitable driver)

    I try to create a connection pool in a Weblogic server 7.0 with the following config:
    URL:
    jdbc:oracle:oci9:@db_name
    Driver Classname:
    oracle.jdbc.driver.OracleDriver
    Properties(key=value):
    user=user_name
    password=user_password
    dll=ocijdbc9
    server=db_name
    protocol=oci
    my computer (windows 2000) has installed Oracle 9i client, and this connection
    pool will connect to Oracle 8i server. Besides, I have config classes12.zip in
    the "classpath" and ocijdbc9.dll in the "path" environment variables.
    Can Oracle 9i driver connect to a Oracle 8i server? Or there is other problems?
    Thanks in advance.

    Please try URL = jdbc:oracle:oci8:@db_name... that should be fine.
    Yes, you can connect to 8i oracle database using 9i driver.
    Also, make sure you have classes12.zip in classpath and ocijdbc9.dll in path.
    Thanks,
    Mitesh
    Jacky Ho wrote:
    I try to create a connection pool in a Weblogic server 7.0 with the following config:
    URL:
    jdbc:oracle:oci9:@db_name
    Driver Classname:
    oracle.jdbc.driver.OracleDriver
    Properties(key=value):
    user=user_name
    password=user_password
    dll=ocijdbc9
    server=db_name
    protocol=oci
    my computer (windows 2000) has installed Oracle 9i client, and this connection
    pool will connect to Oracle 8i server. Besides, I have config classes12.zip in
    the "classpath" and ocijdbc9.dll in the "path" environment variables.
    Can Oracle 9i driver connect to a Oracle 8i server? Or there is other problems?
    Thanks in advance.

  • How to create dynamic connection in business view manager.

    Hi Sir,
    Can u explain how to create dynamic connection in business view manager.
    Thanks
    Vishali Raghava Raju

    HI Vaishali,
       Can you please elaborate your requirement ?
    -Regards
    B

  • How to configure informix connection pool in sun-one appserver 7

    Hello,
    Anybody knows , How to configure informix connection pool properties in sun-one appserver 7?
    Thanks in advance.

    Actually,it couldn't get some advice in here.But now,I known how to configure it,I expended 2 days to search and test it.Follow :
    jdbc class:com.informix.jdbcx.IfxDataSource
    serverName=(INFORMIXSERVER)
    portNumber=1526(default)
    IfxIFXHOST=(host ip)
    databaseName=(your dbname)
    user=(your username)
    password=(your pwd)
    attention:configure right transaction and userthreads in your informix sever
    Hope helpful to someone!

  • How to create a module pool program

    Dear Guru
    I want to know know how to create a module pool program from se80 step by step. I want to know the steps where i will get the four includes like form routines, PAI, PBO, and global data please its very urgent.
    Thanks & regards
    Saifur Rahaman

    hi Saifur Rahaman,
    goto se80 then click find program,
    next u want any name of the program enter as,
    Attribute type as find Module pool click it.
    next u want any package and save and activate.
    program name with create screen with any number then
    click layout and u want any object and save , actived.
    click flow logic , four types as PBO and PAI and POV, POH.
    PBO---> Trigger is before screen.
    its applied for display screen and inactive or no display screen only
    PAI--->Trigger is after screen
    when u want button then its processed.
    POV--> Value requested for F4.
    POH-->Help requested for F1.
    Reward if useful,
    S.Suresh.

Maybe you are looking for