Re: Hibernate and multiple datasources...

From: Kingsley Idehen (kidehen_at_openlinksw.com)
Date: 10/15/04

  • Next message: Kingsley Idehen: "Re: Unable to load JdbcOdbc library"
    Date: Fri, 15 Oct 2004 17:19:30 GMT
    
    

    10/15/2004 5:05:33 AM
    Lionel <> wrote in message
    <416f92db$0$563$626a14ce@news.free.fr>

    > Hi !!!
    >
    > I have an hibernate application thta as multiple databases.
    > Depending on the country of the user, I will access the database of
    his
    > country.
    > All databases have exactly the same structure.
    > How can I manage this with struts/hibernate ?
    >
    > Here is the solution I think I will use:
    > - define a JNDI datasource for each database.
    > - create an hibernate.cfg.xml for each database, using the same hbm
    files,
    > load in context each SessionFactory
    > - use a ServletFilter to open a connexion to the correct database
    depending
    > on the user profile for each http request
    >
    > Do you see any problem in this configuration ?
    > Could I do better ?
    >
    > Thanks.
    What about simply creating one JDBC DSN that connects you to all the
    different databases? If you want to investigate this approach then
    take a look at OpenLink Virtuoso at: http://virtuoso.openlinksw.com .
    It allows you to make one JDBC connection to several ODBC or JDBC
    Data Sources that are bound to a variety of backend databases.
    Alternatively, you can have Hibernate simply bind to one data source,
    since Virtuoso can produce Well-Formed and/or Valid XML data (that is
    accessible via HTTP/WebDAV) from heterogeneous ODBC or JDBC data
    sources on the Fly (using; SQLX, SQL-XML, XML-SQL Schema Mapping).
    So you can give Hibernate a DSN or a URI to an XML doc, in both cases
    the underlying heterogeneous data sources are unified without you
    writing code to handle the complexity of this effort.

    Regards,

    Kingsley Idehen Weblog: http://www.openlinksw.com/blog/~kidehen
    OpenLink Software Web: http://www.openlinksw.com
    Universal Data Access & Universal Integration Middleware Providers.


  • Next message: Kingsley Idehen: "Re: Unable to load JdbcOdbc library"

    Relevant Pages

    • Re: Why Javas math expression (power) is so inconvenient and error prone?
      ... millions of programmers writing business applications that involve ... transactions, data sources, databases, and many small data entities. ... Java is very unsuitable for those applications because it does not ... Only for CODASYL databases and via a preprocessor which made these statements look like standard COBOL. ...
      (comp.lang.java.programmer)
    • Re: Newbie question: query over two data sources
      ... has the link to the other server. ... Another option is to move both databases, via repliction generally, to ... transactional bits yourself and watch both transactions for failure, ... I can easily create connection strings to these data sources, ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: VBScript or VB.Net? (off-topic)
      ... My buddy specifically mentioned connecting to databases being much easier (data sources). ... Systems Admin wrote: ... I am not developer but i like to learn and do programming and it's part of my sys admin job. ...
      (microsoft.public.scripting.vbscript)
    • Re: interchangeable back ends
      ... ends simply by using databases that pointed to different data sources. ... Has anyone found that that actually works in practice? ... Bernhard Sander ...
      (microsoft.public.fox.programmer.exchange)
    • Re: mySQL
      ... An ORM is an Object Relational Mapping tool or framework. ... In Hibernate, for example you can create a class & provide a simple XML file ... objects for you & you do not need to write any sql. ... to have a reasonable understanding of how databases work though when using ...
      (comp.lang.java.help)