In the XML mapping file you simply need to define two <database .../> entries. Just make sure the name attribute for each entry is unique.
In your class mappings simply set the database reference to the appropriate name.
eg <class name="someclass" database="DB1"... />
Note that some cross database joins may not work properly if the databases are stored on different servers. It depends on the abilities of the SQL server and your local configurations.
- Richard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
What should I do if I'd like to connect to more than one DB at the same time since I need to retrieve data from another DB?
Thank you for your time.
Alan
Jul 14
Hi Alan,
In the XML mapping file you simply need to define two <database .../> entries. Just make sure the name attribute for each entry is unique.
In your class mappings simply set the database reference to the appropriate name.
eg <class name="someclass" database="DB1"... />
Note that some cross database joins may not work properly if the databases are stored on different servers. It depends on the abilities of the SQL server and your local configurations.
- Richard.