Connection object in one method not accessible to another method

Hi ,
I have a method init() which contains the following:
PropagatedDatabaseTransactionService.getInstance().getPropagatedDatabaseTransaction().begin();
          java.sql.Connection connection = PropagatedDatabaseTransactionService.getInstance().getPropagatedDatabaseTransaction().getConnection();
try {
Statement stmt = connection.createStatement() ;
and so on
I have 2 other methods in which i wish to use the "connection" object and also "stmt". I dont think I can place the connection code outside a method (also it throws an exception).
How do i change the code so that the other 2 methods can also access the connection to the database?
Thanks

Either pass them as parameters or make them into member variables.

Similar Messages

  • How can I make sure an url to connect to a webinar will not work in another browser?

    How can I make sure an url to connect to a webinar will not work in another browser? The url is using a session cookie instead of username/password to authenticate the user and has the following form: /r5ygd62w5za/?session=breezrek22zu756wgzy8r&launcher=false&refresh_parent=true

    Try the [https://addons.mozilla.org/en-US/firefox/addon/2592/ NoSquint] add-on, it gives greater control over the zoom options.

  • Can one Action from Jpf call another method/Action in other jpf   ?

    hi ,
    "can one Action from Jpf call another method/Action in different jpf "
    we can call other jpf's begin from one jpf , but can we call method of other Jpf from different jpf .
    i m getting error when i m trying to do this .
    No module configuration registered for /pageFl
    dule path /pageFlowControllers/Controller)

    hi,
    write
    carmodel(null) in populateCar() action.
    means
    public void onActionpopulateCar(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionpopulateCar(ServerEvent)
         onActioncarmodel(null);
        //@@end
    Regards
    Trilochan

  • Method not accessible from other classes

    Hi,
    I ve defined a class and would like to create an instance of it from another class. That works fine, I am also able to access class variables. However the class method "calcul" which is defined as following, is not accessible from other classes:
    class Server {
    static String name;
    public static void calcul (String inputS) {
    int length = inputS.length();
    for (int i = 0 ; i < length; i++) {
    System.out.println(newServer.name.charAt(i)); }
    If I create an instant of the class in the same class, the method is then available for the object.
    I am using JBuilder, so I can see, which methods and variables are available for an object. Thanks for your help

    calcul is a static method, that means you do not need an instance of server to run this method. This method is also public, but your class Server is not, your Server class is package protected. So only classes within the same package has Server can use its method. How to use the calcul method?// somewhere in the same package as the Server class
    Server.calcul( "toto" );

  • DirectAccess - one website not accessible

    Hello friends,
    I have UAG DirectAccess-Installation running since some years. Now we found one local Webserver (of hundreds) who is not accessible over DirectAccess. From the UAG Server the Website works. From any other place also, but not over DirectAccess.
    On Client ping gives the IPv6-Address -> DNS works.
    Question: What can I do to find the reason/what are the next steps?
    Grüße/Regards, Jens Klein

    I asume the Web Server is located on you internal network.
    There could me many reasons. To point you out to one of them; If your DirectAccess Client is using the Teredo protocol, make sure your DirectAccess Clients can ping the Web Server. By that I mean the Web Server should allow inbound ICMPv4 from
    your DirectAccess Servers, otherwise you won't be able to access it. This is requirement that is sometimes forgotten.
    Boudewijn Plomp, BPMi Infrastructure & Security
    Please remember, if you see a post that helped you please click "Vote as Helpful", and if it answered your question, please click "Mark as Answer".

  • ITunes on one computer is not accessible on another computer, but the reverse is true -- help, troubleshoot

    My 2009 iMac can connect to my 2013 iMac, but not the reverse. My 2009 can play anything from the 2013 iTunes, but not the reverse. 
    When this problem happened there was also a problem of the sound not working on the 2013 iMac. I went through all the standard procedures for both issues eventually resetting PRAM and finally reinstalling Yosemite, which did not fix either problem. 
    Next, I found an article that had me go into the Audio MDMI app to fix the sound. Perfect. Now the 2013 has sound but still can not connect to the 2009; however, the 2013 can connect to the Macbook and Apple TV. Since I've reinstalled the OS and it can connect to the network and other devices I'm assuming that there is a setting someplace which is set to not connect with the 2009. Is there anything  I can check, either an app or through Terminal?
    I've looked online for over an hour but I can't find anything to help in this particular situation.

    Both computers are logged into the same iTunes account and are on the home sharing network. All of the correct settings have been selected. The problem is intermittent. Sometimes they connect, sometimes they don't. It's not consistent.
    Just a few hours ago I connected the two via Ethernet to transfer files. They worked fine, 60 GB in 19 minutes. Later I went back to transfer about 10GB and they wouldn't connected except through Wi-Fi. Once again, 2009 can get into 2013 but not the other way around. It's driving me nuts.
    At present 2013 is only showing a wi-fi connection to the Time Machine, not the other two computers.
    Any more things to look for?

  • File Connection Error (IOException: Root is not accessible)

    Hi
    I have to read the text file from resourse folder.
    I have writen the following
    InputConnection fc = (FileConnection)Connector.open("file:///C:/WTK22/apps/OpenFile/res/hello.txt");
    but it give me some runtime error like IOException: Root is not accessible
    Thanks

    Hey bluebird before posting this question u should fly over the forum nway i five u solution. Try following
    FileConnection fc = (FileConnection)Connector.open("file:///SDCard/hello.txt");
    and go to http://developers.sun.com/techtopics/mobility/index.jsp
    //PremInd

  • One r/3 accessible from another but reverse not working

    Hi guys
    when i  try accessing one r/3 from another its accesible using Connection to R/3 type connection , but when i try vice versa it throws error saying
    "Connection error , connection  to host myhostnmae , service sapgw00 timed out / CPI-C error CM_PRODUCT_SP"
    what might be the problem

    Hi,
    are you trying to do R3 - R3 connection
    are you testing from TCODE - SM59?
    if so put your user and pass (in logon tab)
    and try remote logon (F7) 
    maybe the host or system number is not ok ?
    ask someone from your basis team to confirm this
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Network currently connected how ever one pc not connected to the internet

    i have the wrt54gl and i got 2 pc's wired and ps3 connected wireless. my dell deminsion e520 was working fine yesterday however today I am unable to connect to the internet today. I reseted everything change the ports and still nothing for e520. But i am still able to share files thru-out the network even my ps3 could see my computer also. any suggestion?

    As you have mentioned in the post, only you 1 PC is not able to go online through the router, an you all other computers are able to go online? If you have any Firewall or Antivirus installed on your computer, try disabling it,and then check if you are able to go online from your Dell PC. If still you are not able to go online then you may try Click on Start - RUN - CMD - "ping yahoo.com" and check if you are getting any replies, If yes then i feel it might be the problem with your Internet Explore.
    Click on Start - Control Pannel - Internet Options - then click on the "Connections" tab and below click on"LAN Settings" and uncheck all the checkboxes and click on Ok.
    Now open your IE and  check if you are able to browse internet on your computer. 

  • One Laptop Connected Wirelessly..ONE WILL NOT

    After waiting a LONG 3.5 weeks without broadband in my new rental property, I took delivery of my homehub yesterday (3 days late).. Have got it set up and all the lights are on.. both my and my wife's iphones are connected to it no bother and my laptop will connect via the ethernet cable and get online no problems either. The issue I have is when I attempt to connect wirelessly. The laptop connects to the hub but is only 'local' when it comes to the internet. Have been and got my fathers (much older) laptop this morning to check what was going on and his went online easy!. This is really puzzling me.. am pretty tech savvy and have connected numerous networks to my laptop sky/bt etc in the past.. but cant get this one to work. Have checked that I am automatically selecting IP address etc.. but no joy.
    PLEASE someone help me.. have been at this since 7am and the missus is scowling at me.. my dad also wants his laptop back.
    Many thanks
    Simon

    try this
    wireless help
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • One computer (Apple) connected to internet, one (Dell) not

    I have a guest trying to get on the internet.  I have airport express and my MacBook is working fine.  Her Dell does not.  It gets hung up - authenticating.  What do I need to do?  Thanks!

    What operating system is the Dell running?

  • Slideshow loading in one frame, not loading in another

    I have two separate slideshows in my document. The slideshow on frame 1 uses  ixia_works.xml, the slideshow on frame 5 uses ixia_windows.xml.  wrote all of my slideshow code on frame 1 and created a variable to hold the xml file.  On frame 5 I assigned the new value of the variable. The slideshow on frame 1 works perfectly; the slideshow on frame 5 won't even load. Where did I go wrong?
    Code on frame 1:
    //in order to work with tweens, necessary to import tween classes
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    stop();
    //if it doesn't exist, make it, else unload it (coming from other frames)
    if (!imgLoader) {
        var imgLoader:Loader;
    } else {
        imgLoader.unload();
    var fadeTween:Tween;
    var xmlRequest:URLRequest = new URLRequest("ixia_works.xml");
    var xmlLoader:URLLoader = new URLLoader(xmlRequest);
    var imgData:XML;
    var whichImg:String;
    var imgNum:Number = 0;
    var totalPics:Number;
    var isFirst:Boolean = true;
    var myTimer:Timer = new Timer(200);
    //when xml is loaded, start timer, run the checker
    function xmlLoaded(event:Event):void {
        myTimer.start();
        myTimer.addEventListener(TimerEvent.TIMER, checker);
        imgData = new XML(event.target.data);
    //loads image
    function showPic():void{
        myTimer.removeEventListener(TimerEvent.TIMER, checker);
        whichImg = imgData.image[imgNum].imgURL;
        totalPics = imgData.*.length();
        imgLoader = new Loader;
        imgLoader.load(new URLRequest(whichImg));
        slideShow_mc.addChild(imgLoader);
        fadeTween = new Tween(imgLoader, "alpha", None.easeNone, 0, 1, 2, true);
    function checker(event:TimerEvent):void {
        if (imgNum == 0) {
            //if this is not the initial load, then you need to unload imgLoader
            if (!isFirst) imgLoader.unload();
            isFirst = false;
            showPic();
        } else if (imgNum < totalPics) {
            imgLoader.unload();
            showPic();
        } else {
            imgLoader.unload();
            imgNum = 0;
            showPic();
    //when you click a button, go to the next/previous image
    function clickHandler(event:MouseEvent):void {
        switch(event.target) {
            case next_btn:
                myTimer.addEventListener(TimerEvent.TIMER, checker);
                imgNum++;
                break;
            case prev_btn:
                imgNum--;
                myTimer.addEventListener(TimerEvent.TIMER, checker);
                break;
        if (imgNum == totalPics) {
            imgNum = 0;
        } else if (imgNum < 0) {
            imgNum = totalPics - 1;
        //determines menu state
        if (navBar_mc.currentLabel == "navIn") {
            navBar_mc.gotoAndStop("navOut");
        //make sure "our work" turns on
        wordWork_mc.alpha = 1;
    //fades previous/next arrows in and out
    function fadeArrow(event:MouseEvent):void {
        switch(event.target) {
            case prev_btn:
                arrowPrev_mc.play();
                break;
            case next_btn:
                arrowNext_mc.play();
                break;
        if (navBar_mc.currentLabel == "navHit") {
            navBar_mc.navActivate_mc.y = 0;
    //menu functionality
    function slideOut(event:MouseEvent):void {
        navBar_mc.gotoAndStop("navOut");   
    //moves hit state of menu once invisible button is rolled over
    function hitState(event:MouseEvent):void {
        if (navBar_mc.currentLabel == "navHit") {
            navBar_mc.navActivate_mc.y = 0;
    //put this here to ensure the commands get executed
    hitState_btn.addEventListener(MouseEvent.MOUSE_OVER, hitState);
    hitState_btn.useHandCursor = false;
    xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
    next_btn.addEventListener(MouseEvent.CLICK, clickHandler);
    prev_btn.addEventListener(MouseEvent.CLICK, clickHandler);
    next_btn.addEventListener(MouseEvent.MOUSE_OVER, fadeArrow);
    prev_btn.addEventListener(MouseEvent.MOUSE_OVER, fadeArrow);
    navBar_mc.addEventListener(MouseEvent.CLICK, slideOut);
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    code on frame 5:
    stop();
    xmlRequest = new URLRequest("ixia_windows.xml");

    Hmm. That's a very good question. It is loading the first slideshow.
    Well, after seeing your question, I replaced the lines on frame 1:
    var xmlRequest:URLRequest = new URLRequest("ixia_works.xml");
    var xmlLoader:URLLoader = new URLLoader(xmlRequest);
    with the following:
    var xmlLoader:URLLoader = new URLLoader();
          xmlLoader.load(new URLRequest("ixia_works.xml"));
    and on frame 5 replaced the code with the following:
    xmlLoader.load(new URLRequest("ixia_windows.xml"));
    and now I get the following error messages on frame 5:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at experiment_fla::MainTimeline/showPic()
        at experiment_fla::MainTimeline/checker()
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()
    And still no loading on frame 5.

  • One iphone not recognized, but another is in Windows XP

    I have a user that has an odd problem.
    This person has 2 iPhones - a 4 and a 4s.  This week the 4 stopped being recognized by Windows XP on his laptop when he plugs it in.  It won't charge from that computer either.  However if you plug it into another computer it will see it fine (and charge it).  The 4s will recognize and charge fine on his computer.
    To recap:
    4s - works fine - syncs and charges when connected to his laptop or any other computer.
    4 - not seen by his computer, will not charge.  Plugged into a different computer, it works fine.
    I'm kinda stumped on this one and I haven't seen a precident that matches this problem.
    Any help would be greatly appreciated!

    I FIGURED IT OUT. THANK FREAKING GOD!
    This is what I did:
    I went to control panel and unistalled iTunes completely, then I installed 10.6.3
    http://support.apple.com/downloads/#itunes which you can find here
    It came up with an error saying that my library had beed used with a more updated verision, basically had to upgrade. I installed iTunes 10.7
    After it had installed and iTunes was running I hooked up both my iPhone and my flash drive, I have more than 1 usb port I figure most computers do now, and by the time and date in the bottom right corner a small icon came up showing that I had devices hooked up. It showed both my iPhone (but did not know what it was) and my flash drive. If you right click on the iPhone it has the option to Troubleshoot it. I did it and my iPhone 5 now FINALLY SYNCS!
    I'm sooo happy now.

  • Using objects with one fill to cut through another

    Sorry for the clunky-description in the subject line. Not sure how to search for a solution to this, though it's probably pretty simple.
    This is Illustrator CS3 on a Mac. Everything is on one layer. I used the white shapes as alterations to fine tune black objects beneath. I'd like to have them permanently intersect so I can be left with only the black shapes (for a single color screenprint). Is there a way to "collapse" the objects and instruct Illustrator to eliminate the white? I've tried everything in the Pathfinder palette without the results I'm after.
    Any suggestions?
    Thanks!
    Brad

    Hi Tman.
    Thanks for the reply.
    1. Yes, it'll be a 1-color silkscreen, ultimately.
    2. Yup, all vector.
    3. No, the gray background was simply there to show you guys the white objects I'd used to fine tune the black brushstrokes. It'll be deleted.
    I see what you're saying. Because the white areas disappear without the background, their existence is inconsequential - once it becomes a PDF, it's just black and white anyhow.
    I just didn't want to worry that *any* object was going to wind up on the screen, or that I had to blend the objects and erase the white ones.
    Thanks!
    Brad

  • PDI changes of one developer not visible to another

    Hi,
    If the PDI changes done by a developer from a SDK solution, activated on the tenant, are to be viewed by another PDI developer or Administrator or any other user in C4C for testing purpose,
    is there any setting to be done ?
    If yes, what and how ? Plz guide.
    Thanks, Sachin.

    Hi Vinod,
    looks like my text was not fully understandable. Let me give an e.g. :
    Suppose developer1 adds a dropdown field to search UI and activates the changes.
    developer1 logs into C4C UI and finds the required field in the UI.
    Now developer2 OR admin user logs into C4C UI and checks if the same field is displayed in the UI, but cannot see it on the screen.
    I want the field (dropdown) to be visible to all users of C4C in the C4C UI.
    Now, kindly let me know if any solution on this ?
    Thanks, Sachin.

Maybe you are looking for