Re: Hibernate and multiple datasources...
From: Kingsley Idehen (kidehen_at_openlinksw.com)
Date: 10/15/04
- Previous message: Lionel: "Hibernate and multiple datasources..."
- In reply to: Lionel: "Hibernate and multiple datasources..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Previous message: Lionel: "Hibernate and multiple datasources..."
- In reply to: Lionel: "Hibernate and multiple datasources..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|