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 :-)

Similar Messages

  • How can I switch the connection pool dynamically during on load happens

    HI,
    I have two data bases which holds same data. i.e Prod_db, Prod_db1,
    I want to switch the connection pool dynamically during load happens
    Ex: During load happens i want to hit prod_db1, after load completes i want to hit prod_db. How to achieve this.

    create dynamic repository variable for DSN using init block so that value is changes based on your timings and use this in connection pool.
    If you use same user and passwords for both the databases that would be easy or else need to follow the same for uid and pwd.
    That should work, if not update.
    If helps pls mark correct/helpful

  • How can I use the Connection Pool with DB2

    Hi All,
    I am facing the problem with the usage for the Connection Pool.
    I want to use DB2 via JNDI lookup.
    But when starting the Weblogic server, Error occured with the following message.
    <Error> <JDBC> <Cannot startup connection pool "MyJDBCPool" Cannot load driver class : com.ibm.db2.jdbc.app.DB2Driver>
    DB2 and Weblogic are on the same machine.
    In case of the use of remote DB2 database, I also encountered the same error.
    Configurations are as follows.
    <JDBCConnectionPool DriverName="com.ibm.db2.jdbc.app.DB2Driver"
    MaxCapacity="10" Name="MyJDBCPool"
    Password="{3DES}gCGsOfD9M6iwOtgL2v/NpA==" Targets="myserver"
    TestConnectionsOnReserve="false" TestTableName="test" URL="jdbc:db2://localhost:6789/yongjoo"/>
    <SNMPAgent Name="mydomain"/>
    <JDBCDataSource JNDIName="acsdb" Name="acsdb" PoolName="MyJDBCPool" Targets="myserver"/>
    Could you please give some information about this problem? I will appreciate your kindness.

    Hi Joe,
    Thanks your help.
    Perhaps It's my fault for Weblogic console's setting.
    After I reset the target server in console, Error message disappeared.
    But, when I call the TestCode, I encountered another error message. The error
    is NameNotFoundException.
    When lookingup the JNDI name, NameNotFoundException errer occured. I tried to
    change my setting and JNDI name, but the results are the same.
    Would you please give me some information about this one more time? I will be
    appreciated for your help.
    Follows are Config.xml
    <JDBCConnectionPool DriverName="com.ibm.db2.jdbc.app.DB2Driver" MaxCapacity="10"
    Name="MyJDBCPool" Password="{3DES}gCGsOfD9M6iwOtgL2v/NpA==" Targets="myserver"
    TestConnectionsOnReserve="false" TestTableName="test"
    URL="jdbc:db2://localhost:6789/yongjoo"/> <SNMPAgent Name="mydomain"/>
    <JDBCDataSource JNDIName="acsdb" Name="acsdb" PoolName="MyJDBCPool"
    Targets="myserver"/>
    and follows are TestCode,
    url = "t3://localhost:7001"; //default URL
    datasource = "jdbc/acsdb";
    Context ctx = null;
    Hashtable p = new Hashtable();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, url);
    try{
    ctx = new InitialContext(p);
    System.err.println("initialContext(p)"+ctx); <-- success
    ds = (DataSource)ctx.lookup("java:comp/env/jdbc/acsdb");
    }catch(NameNotFoundException ne){
    throw new ConnectionException(); .
    }catch(NamingException ne){
    throw new ConnectionException();

  • How can i use the connection pool in JDBC2.0

    Thanks

    Hi,
    You can use DbConnection broker which directly returns connection to DB
    Try http://www.javaexchange.com/
    In that you can specify max and min pool connection pool size
    see example below:
    DbConnectionBroker dbBroker = new DbConnectionBroker(strDBDriver, strDBURL,strDBUser, strDBPassword, iMinPoolSize,     iMaxPoolSize, strLogFile, dblTimeInMillisBetResets);

  • How can we implement the currency translation in a query definition

    How can we implement the currency translation in a query definition and should it modified for each and every type of currencies

    hi rama krishna
    i think u can not get any translation in Query. this is only for het the report as it is there in tables. if u want to write a report take a help of the Abaper
    hope u goit,assign points if u ok for this
    thanks
    subbu

  • I am unintentionally come to delete the bluetooth connection to my heart rate monitor in my iPhone 4s. How can I restore the connection?

    I am unintentionally come to delete the bluetooth connection to my heart rate monitor in my iPhone 4s. How can I restore the connection?

    Thanks, but unfortunately for me the Polar H7 does not have any buttons or anything that can actively affect the pairing, it is manifest just a transmitter. Pairing can apparently only be done by finding the Polar H7 in the unit that you want to pair with (my 4s) and after my delete of the device, my iPhone 4s does not retrieve it as a Bluetooth device.

  • I cannot load my google calendar, how can i decrypt the connection in order to have access?

    The information about this website says that the page has been encrypted because there is no authorized owner. I need access to my google calendar from work.
    How can i decrypt the connection? Is there other way to fix the problem?

    Restart holding down the CMD+R keys, launch Disk Utility and erase the HD, quit DU, and restore the OS. On first boot, use the Setup Assistant to do the migration. Details in Pondini's Setup New Mac guide.

  • My wireless printer keeps going offline--how can I "stabilize" the connection"

    my wireless printer keeps going offline--how can I "stabilize" the connection?
    This question was solved.
    View Solution.

    Hello gerrie,
    What i would do is Power cycle the printer and the router as well
    -basically having them turned off for about 10-15 seconds
    -and then powering back the router back on wait for all the lights to turn on completely
    -and after that is back up and running i would turn the printer back on and re-establish the connection between the printer and the Wireless network
    I am an HP employee.
    __ if this Solution has helped Please Mark as Resolved and feel free to Provide a Kudos__

  • How can I download the original Apple version of Java 6 please?

    I have an iMac OSX 10.10.1 Yosemite with Java 1.8.0_25. How can I download the original Apple version of Java 6 please? All my attempts are referred to the latest version of Java, which I already have! Catch 22!
    Thanks

    Java
    http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US

  • How can i get the time to appear on my stored data in notepad

    Hi all,
    I was wondering how can i get the time to appear on my stored data in notepad? I saw an example before but i forgotten which example was it.. Any ideas??
    holla
    Attachments:
    TextFile1.txt ‏3 KB

    Hi
    Im using Labview 8.2. Currently it just shows the data without the time. Im not sure what to do. It works perfectly though. I just want the time to appear on my notepad along with my data
    holla
    Attachments:
    Testing1.txt ‏1 KB
    Untitled 231_LV80.vi ‏23 KB

  • How can I know the version of Application Server Java Virtual Machine

    How can I know the version of Application Server Java Virtual Machine?
    Thanks a lot.

    Thats easy. Your jdk/jre are located in the App Server home directory. Just run the java command under the jdk directory with the "-version" switch and it will provide you with detailed information about your VM.
    For example if you're doing it at command prompt it will be something like
    java -versionI hope this will be useful to you.
    Regards,
    Wasif

  • How can I know the connections are pooled?

    Hi. everyone.
    I am wondering how I can monitor the connections are pooled.
    I am using web-logic as a web server and oracle9ir2 as a
    database server.
    When I was deploying an application to the web-logic, I created a
    connection pool.
    And then, I run the application respectively(exactly two).
    However, there is only one session in the "V$SESSION" dictionary.
    I do not understand why there is only session in the V$SESSION, although
    I run two application respectively.
    In addition, how can I monitor the oracle conenctions are pooled?
    Does V$SESSION have nothing to do with oracle connection pool?
    Thanks in advance.
    Have a good day.
    Best Regards
    Ho.

    Dear Sabdar Syed.
    Thanks for your reply.
    Here is the result of v$license.
    SQL> select * from v$license;
    SESSIONS_MAX : 0
    SESSIONS_WARNING : 0
    SESSIONS_CURRENT : 6
    SESSIONS_HIGHWATER : 6
    USERS_MAX : 0
    What does it mean, sessions_max(0), sessions_current(6), users_max(0)
    I am still confused.
    Could you give me a more detailed explanations?
    Thanks in advance. Have a good day.
    Regards.
    Ho.

  • Hi how can i implement the scenario.......plz reply asap.........

    HI folks,
    i have a typical problem in bex .
    my scenario is:i am having 2 values say 'x','y'.
    i want to implement a formula like x-y.
    if the x value is negative then i have to get the result as negative after the 'y' value get subtracted.if 'x' is positive, i have to get positive value after subtracting 'y' value.
    please let me know how can i implement this scenario in bex.
    by using a formaula or condition or anything else. please let me know clearly including the expression asap.
    Best reagards,
    ashok.

    answered

  • How can I implement the security ports..?

    How can I use the security ports and SSL through javamail..?
    Can someone tell me what are the necessary things to b done while connecting to "Gmail" through Javamail??....like how to authenticate..etc??
    Edited by: shyamwdr on May 20, 2008 6:21 AM

    Did you read the FAQ?

  • How can I get the connection code for the magic track pad?

    I want to use my magic trackpad and I scrapped the box with the connection code. How can I get it again? I don't need it for Mac, but yes for windows...

    user570667 wrote:
    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    ZulqarnainDid you see old threads for similar topic/discussion? -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Java+AND+Concurrent+AND+Source+AND+Code&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

Maybe you are looking for

  • Which Macbook Pro is good for a college student?

    Hi! I want to buy the new Macbook Pro with Retina Display. My current laptop has 455 gb in which I only used 83 gb of it since the past 5 years I've been using it. I know that the original macbook pro is good too but its way heavier than the Macbook

  • Mac Mini for the Home

    Hello, This question has been posted many times all over the internet but the responses are not specific to what I need to know. I have a MBP 2010 that is my main workhorse for everything. I was thinking of adding a Mac Mini to my network to host iTu

  • Can't get last note of piece to sound as long as it's written ..why ?

    Hello, I have a strange problem: I'm using 2 instances of VSL Flugelhorn ( playing simultaneously ), in Logic 9, but I cannot get the last note of the piece in either Flugelhorn to sound as long as it's written. I've tried altering the velocity,  the

  • Files and Folders fixed on the desk top

    I'm using 2 monitors and would like to move files/folders to the secondary monitor. I would also like the flexibility to position the folders where I want them and not where they end up automatically. Suggestions please.

  • When I open gmail, I cannot use the vertical scroll bar.

    When I use the gmail website on firefox, the vertical scroll bar. As there is no horizontal scroll bar on the website, the vertical scroll bar layers over the top of the page resizer and makes the arrow button for the scroll unusable. Please advise.