Connection to multiple databases using a single EJB

How can I connect to multiple Databases (using @PersistenceContext) using an EJB?
Did I need to connect various Entity Managers corresponding to the each database and simply send my Queries?
I am using Glassfish Application Server
Netbeans IDE
Java Derby Database
Oracle Database
Java Persistence API
Thanks in Advance

Yes, you need a persistence context and thus entity manager per database. Depending on what you want to achieve you may also need to go to the next level in your skill set and learn all about distributed transactions.

Similar Messages

  • Multiple databases in a single query

    I need to query multiple databases in a single query.
    e.g.
    Database d1 contains table t1 with column id
    Database d2 contains table t2 with column id
    I need a query like
    SELECT * FROM t1, t2 WHERE t1.id = t2.id;
    is this possible in jdbc? if yes can anyone help with some sample code?
    thanks,
    Ashish Saraf

    It is not possible using the JDBC API to query tables in two or more databases using a single query. The reason is that a JDBC Connection is made to a single data source.
    However, some databases support the idea of federations or linked tables. What you do is inside the database manager link or federate a table that is present in another DBMS. Then, pose a single JDBC query to the one DBMS which will have its own table and links to the external tables.
    Another approach is to use a special JDBC driver with a built-in integration engine that will perform a query across multiple databases. In effect, the system poses separate queries to the different databases and integrates and joins the data together for you automatically on the client-side. That is much easier than doing it yourself in code, but that is also possible for simple queries.
    As part of my research program, we have released a shareware version of the UnityJDBC driver that can query multiple databases using a single SQL query. For more information, see:
    http://www.unityjdbc.com
    http://www.cs.uiowa.edu/~rlawrenc/research/projects.html
    Sincerely,
    Dr. Ramon Lawrence
    Assistant Professor
    Department of Computer Science
    University of Iowa
    [email protected]

  • How to add multiple databases for a single frontend

    We have a project based on distributed databases and we have to workout on .Net framework.I want to know some information of connecting multiple databases for a single frontend and how can we access them.
    If so we have connected 2 databases for a single frontend in future if I want add one more database to it how it will be possible to do it without disturbing the current connectivity.
    Please help me in resolving this problem.
    Thanks......

    hi,
    what do you mean by connecting 2 databases? can you explain further?
    using entityframework you can connect to different databases
    public class CustomerContext : DbContext
    public ReportContext()
    : base("DefaultConnection")
    public DbSet<Customers> Customers { get; set; }
    and your connectionstring (config file)
    <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=D:\\Database\Project.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
    </connectionStrings>
    you can add more connection strings on it.
    https://msdn.microsoft.com/en-us/library/vstudio/cc716756(v=vs.100).aspx
    https://msdn.microsoft.com/en-us/library/ms254978(v=vs.110).aspx
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Does BO 4.1 enable universe to connect to multiple database?

    Using BO 3.1, we can only connect an universe to single database. However, with BO 4.1 will it be possible to connect a single universe to multiple database?
    Regards
    Vinay

    Vinay, You can connect Universe to multiple databases using IDT (Information Design Tool). Find the below link for reference.
    SAP Business Objects Multi Source Universe - Information Design Tool - YouTube
    Regards,
    Sujitha

  • Application that connects to multiple databases.

    I am developing an application that performs many task, but one in particular is connecting to multiple databases and creating user accounts in each all with the push of a single button. I have tried putting connect statements in the trigger code but I don't get the desired results.
    How would I get my application to switch database connections while in execution?
    Please reply to the forum, or email me @ [email protected]
    Thank you.
    Travis

    Hi
    The only possible way which I could find for your requirement is that of DB Links. Establish DataBase Links among the multible databases, with which you want to work in one session. Peform all your actions through the DB Links.

  • How to connect to oracle10g Database using oracle11g Enterprise Manager.

    Hi,
    please suggest me how to connect to oracle10g Database using oracle11g Enterprise Manager.
    i did setting in tnsnames.ora file of oracle11g database but when i am trying to connect sys@testvsr and password
    using oracle11g Enterprise manager its not connecting but from command prompt its connecting.
    its not acccepting hostname its simply telling invalid username and password ,if i remove and try to connect its connecting.
    so please suggest its very urgent my manager is nagging.
    Regards,
    Srinu.

    you cant attach a database 10g instance with
    Enterprise manager of 11g as enterprise manager is
    meant for a single database only .. your problem cant be solved
    enterprise manager it can be solved by using GRID CONTROL
    For more details visit oracle documentation..
    Hope This helps..
    BI TC

  • Connecting to Multiple database

    Hi how could i use Dreamweaver CS3 to connect to multiple
    databases in phpmyadmin?

    Maneet Puri wrote:
    > Hi,
    >
    > I have used a lot the extensions of Dreamweaver for
    implementing various
    > dynamic features with connectivity to MySQL databases,
    and I don't think there
    > is any extension which allows connecting to the multiple
    MySQL database. To do
    > this you will have to make changes to scripts, at one
    point of time from one
    > script in one instance there can just be one connection
    to one MySQL database,
    > what you can do is switch between the users and database
    of mysql. PHP offers a
    > function mysql_change_user() to switch users and connect
    to various different
    > MySQL database.
    What is stopping you from having more than one database
    connection
    string? You can select the connection from each behaviour
    that needs
    different databases.
    Or is then intent to combine the data from 2 database into
    one recordset?
    Dooza
    Posting Guidelines
    http://www.adobe.com/support/forums/guidelines.html
    How To Ask Smart Questions
    http://www.catb.org/esr/faqs/smart-questions.html

  • Unable to connect to Oracle Database using Oracle Sql developer 2.1.1.64

    Hi Everyone,
    I am searching for some help regarding my problem with Oracle connectivity. I have installed Oracle 11g release 2 on my Windows XP Professional Laptop. For a few days after installation i could connect to the Oracle database with the SYSTEM account using Oracle SQL developer ( installed on the same Laptop) but now i am unable to do so.It gives me this annoying message:
    An error was encountered performing the required operation  Got a minus one from read call .Vendor code 0
    However i am able to connect using Sql Plus by supplying the username SYSTEM and the corresponding password.
    My TNSNAMES .ora file is as follows:
    ORACLE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORACLE)
    ORACLR_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (CONNECT_DATA =
    (SID = CLRExtProc)
    (PRESENTATION = RO)
    My Listener.ora file is as follows:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:D:\app\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    (SID_DESC =
    (GLOBAL_DBNAME = Oracle)
    (ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
    (SID_NAME = Oracle)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (PROTOCOL_STACK =
    (PRESENTATION = GIOP)
    (SESSION = RAW)
    ADR_BASE_LISTENER = D:\app
    My Sqlnet.ora file is as follows:
    SQLNET.AUTHENTICATION_SERVICES= (NTS)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    I am new to Oracle and so i need someone in this forum who can help me resolve this problem. Also i even tried connecting to the database using Toad 10.5.0.41. It give me the following error:
    ORA 12537 : TNS Connection closed
    Thanks for your patience and help in advance.
    ---Prashant

    Hello Irian and Sue,
    I can connect to the Oracle database using SQL Plus. Now when i TNSPING ORACLE from command line i get the following message :
    Used parameter files:
    D:\app\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =localhost
    *)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACLE)))*
    TNS-12537: TNS:connection closed
    Thanks for your response to my initial post.Do u have any other methods to resolve this?

  • Multiple OUs using a single common WIP?

    Multiple OUs using a single common WIP?
    We have a manufacturing facility that contains tools and personnel that belong to multiple operating units (OU). Of course, the manufacturing part should work as if it is one site. Since all equipment and personnel work on all jobs there is no distinction between the higher level operating units and legal entities and books at the low level manufacturing point of view. However, costing must be costed appropriately by OU and the GL books of the seperate legal entities must be kept correctly and seperately.
    How can Oracle Applications manufacturing modules be setup to handle a common manufacturing area used by personnel and equipment that is owned and costed by seperate OUs? I am unable to locate an example or reference to this type of situation in any manufacturing manuals.
    Thanks

    Not sure that you will be able to find your example. You explain an interesting problem that is very unique. I do not think that you will find a standard system set up to meet your need. The work around solutions, that come to mind quickly, would require a standard cost environment and involve changing the period close process for manufacturing.

  • How can I connect to the database using ODBC within excel.

    Hi,
    How can I connect to the database using ODBC within excel and just refresh the data when needed.
    Thanks,
    Priyanka
    Edited by: user554934 on Jun 9, 2009 2:53 AM

    This is NOT an APEX relevant question, try posting it in the SQL/PL/SQL Forum..
    Thank you,
    Tony Miller
    Webster, TX

  • Inserting multiple rows using a single Insert statement without using dual

    Hi all,
    i am trying to insert multiple rows using a single insert statement like the below one.
    The below one works fine..
    But is there any other change that can be done in the below one without using dual...
    insert all
    into ps_hd_samp (num1,num2) values (1,1)
    into ps_hd_samp (num1,num2) values (2,2)
    into ps_hd_samp (num1,num2) values (3,3)
    select 1 from dual;

    NiranjanSe wrote:
    Hi all,
    i am trying to insert multiple rows using a single insert statement like the below one.
    The below one works fine..
    But is there any other change that can be done in the below one without using dual...
    insert all
    into ps_hd_samp (num1,num2) values (1,1)
    into ps_hd_samp (num1,num2) values (2,2)
    into ps_hd_samp (num1,num2) values (3,3)
    select 1 from dual;
    SQL> create table ps_hd_samp (num1 number,num2 number);
    Table created.
    SQL> insert all
      2  into ps_hd_samp (num1,num2) values (1,1)
      3  into ps_hd_samp (num1,num2) values (2,2)
      4  into ps_hd_samp (num1,num2) values (3,3)
      5  select count(*)
      6  from ps_hd_samp;
    3 rows created.
    SQL> select * from ps_hd_samp;
          NUM1       NUM2
             1          1
             2          2
             3          3

  • Connect to oracle database using c program

    I am using AIX environment and i want to connect to oracle database using c program.

    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10825/pc_03dbc.htm#i5880

  • How to connect to 9i database using 8i sqlplus?

    Hello,
    My Oracle server is running 9.2.0.1
    My Oracle client processes run on the same machine using Oracle 8i (ORACLE_HOME is set to 8i home).
    I cannot connect to 9i database using 8i sqlplus.
    My ORACLE_HOME for client environment is set to 8i home.
    How can I access 9i database using 8i sqlplus?
    Thanks in advance!

    I saw this answered in another thread:
    8i sqlplus not working on 9i
    Please try not to cross post.
    Alison

  • Getting Multiple Recordsets using A Single Connection using jdbc-odbc

    I have a java application which uses sql 7.0 database server. I want to have multiple recordsets created using a single connection using jdbc-odbc bridge. Kindly let me know the procedure.

    Well, you create a recordset, then you create another one, and so on. Are you actually having a problem or you just don't know where to start?

  • Q:Multiple databases using Single default listener ??

    I created a database on a host and have been using the default listener to connect to it - no entries in listener.ora/tnsnames.ora -
    now I have another database created on the host (different service_names) , but am unable to connect to it using default listener
    without making entry in tnsnames.ora .
    Q - Why does this work for the first DB I created and not for the second ?
    Edited by: user7480241 on May 28, 2009 8:16 PM
    Additional details about the env
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL>
    SQL> show parameter listener
    NAME TYPE VALUE
    local_listener string
    remote_listener string
    SQL> show parameter service_names
    NAME TYPE VALUE
    service_names string MAHARAJA
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> show parameter listener
    NAME TYPE VALUE
    local_listener string
    remote_listener string
    SQL> show parameter service_names
    NAME TYPE VALUE
    service_names string MAHARAJ2
    SQL>
    -bash-3.00$ lsnrctl service
    LSNRCTL for Solaris: Version 10.2.0.2.0 - Production on 29-MAY-2009 11:19:01
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    Services Summary...
    Service "MAHARAJ2" has 1 instance(s).
    Instance "MAHARAJ2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    LOCAL SERVER
    Service "MAHARAJ2_XPT" has 1 instance(s).
    Instance "MAHARAJ2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    LOCAL SERVER
    Service "MAHARAJA" has 1 instance(s).
    Instance "MAHARAJA", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    LOCAL SERVER
    Service "MAHARAJA_XPT" has 1 instance(s).
    Instance "MAHARAJA", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    LOCAL SERVER
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0
    LOCAL SERVER
    The command completed successfully
    -bash-3.00$ tnsping MAHARAJA
    TNS Ping Utility for Solaris: Version 10.2.0.2.0 - Production on 29-MAY-2009 11:20:01
    Copyright (c) 1997, 2005, Oracle. All rights reserved.
    Used parameter files:
    /export/home/oracle/network/admin/sqlnet.ora
    Used EZCONNECT adapter to resolve the alias
    Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=MAHARAJA.))(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.2.15)(PORT=1521)))
    OK (30 msec)
    -bash-3.00$ tnsping MAHARAJ2
    TNS Ping Utility for Solaris: Version 10.2.0.2.0 - Production on 29-MAY-2009 11:20:10
    Copyright (c) 1997, 2005, Oracle. All rights reserved.
    Used parameter files:
    /export/home/oracle/network/admin/sqlnet.ora
    TNS-03505: Failed to resolve name
    DB & Global Names
    SQL> show parameter name
    NAME TYPE VALUE
    db_file_name_convert string
    db_name string MAHARAJA
    db_unique_name string MAHARAJA
    global_names boolean FALSE
    instance_name string MAHARAJA
    lock_name_space string
    log_file_name_convert string
    service_names string MAHARAJA
    SQL> show parameter name
    NAME TYPE VALUE
    db_file_name_convert string
    db_name string MAHARAJ2
    db_unique_name string MAHARAJ2
    global_names boolean FALSE
    instance_name string MAHARAJ2
    lock_name_space string
    log_file_name_convert string
    service_names string MAHARAJ2
    SQL>

    Why does this work for the first DB I created and not for the second ?Because Oracle tries to make it easy for folks.
    listener.ora is not required for V10.
    tnsnames.ora changes are required so SQL*Net can identify the 2nd DB; so do the necessary as document at http://tahiti.oracle.com

Maybe you are looking for

  • Mixing RAM Speeds In iMac G4 1GHz 17" Flat-Panel?

    I'm just checking here. I have an iMac G4 1GHz 17" Flat-Panel, Model M8935LL/A (USB 1.1 version) that currently has the standard 256MB PC2100 (266 MHz) RAM module installed in the factory slot, and a 512MB PC2700 (333 MHz) RAM module installed in the

  • Attempting to copy the disk "IPOD" failed. Disk could not be read from or written to?

    So..... I own a 5th genereation Ipod Nano. On a windows PC. On my iTunes all my music and playlists exist. On my actual Ipod it only shows 3/4 of my music (for some reason it wont sync the rest). It also shows zero playlists on my Ipod. I now cant sy

  • Conditions in scheduling agreement.

    Hello Guru, I am creating scheduling agreement through ME31L.While entering conditions I am only able to enter few conditions like  gross price,discount etc.which are in pricing procedure RM1002.When tried to enter condition FRA1 got error "Condition

  • Daughter's iPod Touch Stolen

    Hi, My daughter's iPod Touch was stolen at her school today. She has the iPod locked with a passcode. Is that going to render the iPod useless to whomever stole it, or can they just restore or erase it somehow? Thanks, Ray

  • Floating keyboard problem

    I have this floating keyboard problem. Is there a fix to this? I jail broke my device and I know it's not anything I downloaded after that because none of the things I downloaded have anything to do with mail or photos. This only happens when I try t