How can I look up DataSource from one EJB to the other EJB?

Image that, I have 3 databases:
DB1
DB2
DB3,
And then, 03 DataSources is deployed in DS EJB, named DataSource1, DataSource2, DataSource3.
In the other App EJB, I have Connection Management function, as follows:
public Connection getConnection(databaseKey) {
if (databaseKey.equals("DB1")){
connection = remote.lookup("DataSource1");
}else if (databaseKey.equals("DB2")){
connection = remote.lookup("DataSource2");
}else if (databaseKey.equals("DB3")){
connection = remote.lookup("DataSource3");
return connection;
How can I access DataSource 1,2,3 from the other EJB? How to config EJB server for that?
Thanks in advance!
Now, I have the other App EJB. Some class will require one of the above DataSource from DS EJB through function getConnection(databaseKey){}

I strongle suggest you to use a ServiceLocator for this . It will be very easy to identify.Go to the sun home page and look for a servicelocator pattern.You can even directly use that code for you.

Similar Messages

  • How can I import my iphotos from one account to the other?

    Someone knows step by step iphoto from one account to the other. I am admin but still I do not know how to bring my iphotos to a different account
    thanks for help
    marc

    Just the Photos?
    Export them from iPhoto to a folder on the desktop
    Put that folder in the Users/Shared folder.
    Switch User.
    Drag the folder from the Shared folder to whereever you want it.
    Share the Library?
    For iPhoto 09 (version 8.0.2) and later:
    What you mean by 'share'.
    If you want the other user to be able to see the pics, but not add to, change or alter your library, then enable Sharing in your iPhoto (Preferences -> Sharing), leave iPhoto running and use Fast User Switching to open the other account. In that account, enable 'Look For Shared Libraries'. Your Library will appear in the other source pane.
    Any user can drag a pic from the Shared Library to their own in the iPhoto Window.
    Remember iPhoto must be running in both accounts for this to work.
    If you want the other user to have the same access to the library as you: to be able to add, edit, organise, keyword etc.
    Quit iPhoto in both accounts. Move the Library to the Users / Shared Folder (but note: some users find ongoing permissions issues with the Library in this location. It might be better to use an external HD set to ignore permissions, a Disk Image or even partition your Hard Disk.)
    In each account in turn: Double click on the Library to open it. (You may be asked to repair the Library Permissions.) From that point on, this will be the default library location. Both accounts will have full access to the library, in fact, both accounts will 'own' it.
    However, there is a catch with this system and it is a significant one. iPhoto is not a multi-user app., it does not have the code to negotiate two users simultaneously writing to the database, and trying will cause db corruption. So only one user at a time, and back up, back up back up.

  • My daughter and I each have iTunes libraries on the same computer, how can I move some songs from one library to the other?

    My daughter and I each have iTunes libraries on the same computer, how can songs from one library be moved to the other?

    So, if she purchased a song from iTunes in her library, I will also have to purchase the same song to add to my library?

  • How to make a JDialog scrolling from one position to the other.

    Hi all,
    I want to move a JDialog from one position to the other(actually I want to scrolling/moving as messenger notification appear on top of the system tray) on the desktop.
    Anyone of you can give me a clue.
    Thanks

    Ok here what I have try up to now. First make the initial position of the JFrame as follows.
        private void SetWindowLocation()
            final int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
            final int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
            final int frameHeight = this.getHeight();
            final int frameWidth = this.getWidth();
            int _y = (screenHeight - frameHeight - 32);
            int _x = (screenWidth - frameWidth);
    // Initial location
            this.setLocation(_x, _y); 
    }This code place my Frame in the lower-right corner on top of the system-tray.
    Then as you guys says, try to work on a Timer. Now I'm stuck with the action listener. I try to move the frame to upper-right corner.
        private void SetWindowLocation()
            final int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
            final int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
            final int frameHeight = this.getHeight();
            final int frameWidth = this.getWidth();
            int _y = (screenHeight - frameHeight - 32);
            int _x = (screenWidth - frameWidth);
    // Initial location
            this.setLocation(_x, _y); 
            _timer = new javax.swing.Timer(100, incrementYPosition);
    ActionListener incrementYPosition = new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                       while(_y > 0){
                            // do the processing here.
                            // reduce the _y value and set the new location with _x
                    };I'm stuck with that how to involve with the ActionListener here. :(:( After set the initial location how to deal with the ActionListener.
    Any help.

  • How to drag a painted square from one panel to the other?

    Hi there,
    I'm a student IT, and for the course Programming, which uses Java, we have to write a game.
    I've got a JFrame with two JPanels. Both are overriding paint(Graphics g). One JPanel, let's say JP1, draws a board with 196 squares, the other, JP2, draws 21 pieces made up from the same size squares. What I want is, when I press on a piece in JP2, that I can drag that piece over to the board, JP1, and when I release the mousebutton, the piece is drawn in the board.
    How can I realize the dragging part? I've tried with an extra JPanel, with the size of the JFrame, but then either JP1, JP2, or both won't draw anymore.
    Can someone help me with this?
    Check here for a paint what I mean (don't mind my painting skills :p). At no.1, the mousebutton is pressed on the piece, at no. 2 the dragging starts, and at no. 3 the mousebutton is released again.
    Hope I've provided you enough information, I would post the source code here, but it's a lot in Dutch, and it may just confuse you ;)
    Greetings,
    Niek

    Ok, I'll study the link, and try to post my threads in the right section next time ;)
    Didn't even came up with me there might be a tutorial or something for this..
    Thank you! ;)
    Edited by: Niekfct on 17-mrt-2009 21:19

  • How do I transfer purchased apps from one mac to the other?

    When i want to sync my iPhone in iTunes on my new computer I will lose all of the apps that I purchased.
    Can someone tell me how to sync it in a way (or some other solution) so I can keep my purchased apps? 
    I'm using the same ID as on old mac.
    I have been searching on the internet for help, but I can't find a clear answer.
    Thanks in advance.

    1) authorize iTunes on the new machine for your iTunes store account(s)
    2) connect your device and right-click or control-click it in the iTunes Source list, then choose transfer purchases from the shortcut menu that appears.
    3) sync the device
    iTunes will wipe the iPhone but, since you transferred your purchases in the previous step, your content will be in your library and you can re-populate the iPhone with it.
    btw, purchased apps can be redownloaded over and over free of charge ...
    How to redownload purchased apps from the App Store
    ... and so can music and books
    http://www.apple.com/itunes/whats-new/

  • I have 2 email accounts set up. I can now get new messages from one but not the other one.

    I followed the steps outlined in a previous message. I have a Yahoo Small Business Account. I think all of the settings are correct. I can't see any new messages on one of the accounts. One message from 7-20-14 keeps coming up over and over.
    When I press Get mail, I see "downloading message 1 of 55 to [email protected], but then it changes to "nothing to download".
    Can you help me retrieve my messages from the last 3 days? Thank you.

    I think you will find an anti virus program is causing the issue here. They often go a bit nuts when Thunderbirds version number changes.
    Try changing the settings to disable email scanning in your anti virus.

  • How do you get iTunes music from one computer to the other?

    I activated iCloud, home sharing on multiple computers and i still don't know how to share my music and movie files from itunes.

    Click here and pick the option which best fits your situation.
    (90747)

  • How to move a transport request from one client to the other

    Hi,
    I created a new transport request with a lot of elements (and also some modifications), but I made it in the "wrong" client on the system. Now I have the question if there is any possibility to change the client-relation of a  transport request via SE01 (or similar transaction). Copy and Paste of the element list isn't the optimal way, because there are also table contents in the transport request.
    Can you give me a hint?
    Thank you
    Kind regards
    Markus

    Yes you can change the traget client.
    Check the TR properties and set the taget client .

  • How to move an iDrum beat from one project to the other

    I have a project with an iDrum beat that I want to copy into another project file. I browsed the package contents and it only had Real Instrument .aif files. I didn't save the beat in iDrum. Can I just drag it over somehow?

    rsherid wrote:
    I have a project with an iDrum beat that I want to copy into another project
    copy it, then paste it

  • How can I move apps from one computer to the other?

    How can I move apps from one computer to the other?
    (preferably without iCloud)

    Backup your iTunes library to an external drive and onto the other computer
    http://support.apple.com/kb/ht1751

  • HT204053 How can I transfer my apps from one account to another

    How can I transfer my apps from one account to another

    Apple will not permit transfer of applications from one account to another. Suppose your mom has presented an iPad to you and before presenting she has downloaded some Apps with her account. If you want to update those Apps, you must know her pass word or send the iPad to her and request her to update and give back. If you feel it is time consuming and difficult, the best way is purchase new iPad and down load  the latest version of App. Whenever you come across you go on purchasing new iPad. This will help you to have latest version of iPad with you.
      Ramanujam, Hyderabad.

  • When I use Home sharing, I can see the library I want to copy, but when I highlight the library, the import button does not show up. Also, it will not let me drop and drag. How do I get music from one computer to the other computer?

    When I use Home Sharing, I can see the library I want to copy under Shared, but I can't get it save on the computer under the regular library. I go to edit and "select all" but there is no import button that is in the right hand corner. Also, it will not let me click and drag the music. How do I get it from one computer to the other?

    Since both computers are connected via the network, you could simply copy the ENTIRE iTunes folder from one computer to another via the network.
    If both computers are running Windows, use the Easy File Transfer Utility built into Windows to move iTunes and all other user media/data.

  • How can I move purchased apps from one itunes account to another account?

    How can I move purchased apps from one itunes account to another account?

    You can't. The apps must be purchased separately.

  • I have no problems copying iMovie Events from one Mac to another, however, how can I copy iMovie Projects from one Mac to another?

    I have no problems copying iMovie Events from one Mac to another, however, how can I copy iMovie Projects from one Mac to another?  Any help will be appreciated.  Thank you.

    This should give you some good insight, I'd probably store them on an External HD on the old machine and then just drag and drop to the new machine.
    https://discussions.apple.com/docs/DOC-4141

Maybe you are looking for