Questions tagged [multiple-databases]
631 questions
69
votes
4 answers
How to use 2 or more databases with spring?
I have an application that runs Spring MVC.
I need it to access 2 different databases in my app (one is a PostgreSQL and the other one is a MySQL database).
How do I configure this using just annotations or application.properties file?
Regards.

Plicatibu
- 1,692
- 2
- 19
- 20
54
votes
7 answers
Django - how to specify a database for a model?
Is there a way to specify that a model (or app, even) should only ever use one particular database?
I am working with a legacy database that I don't want to change. I have two databases - the 'default' is an sqlite one that could be used for admin…

pfctdayelise
- 5,115
- 3
- 32
- 52
42
votes
3 answers
Can multiple (two) persistent stores be used with one object model, while maintaining relations from one to the other?
Introduction
My iOS project ships with a Core Data persistent store weighing some 160MB in SQLite format. There is a ton of grouped information in there, in which users should be able to mark favorites. For this, I need (at least part of) the…

epologee
- 11,229
- 11
- 68
- 104
42
votes
5 answers
How to run the same query on all the databases on an instance?
I have (for testing purposes) many dbs with the same schema (=same tables and columns basically) on a sql server 2008 r2 instance.
i would like a query like
SELECT COUNT(*) FROM CUSTOMERS
on all DBs on the instance. I would like to have as result 2…

UnDiUdin
- 14,924
- 39
- 151
- 249
40
votes
4 answers
Querying multiple databases at once
I have WordPress instances with each in its own database. For an update I need to query all active plugins, that are stored in a table 'wp_options' and accessible via
WHERE option_name='active_plugins'
How can I access all active plugin settings…

Boldewyn
- 81,211
- 44
- 156
- 212
37
votes
4 answers
How to configure transaction management for working with 2 different db in Spring?
I have 2 databases (MySql and HSQLDB). I configured 2 data sources and 2 EntityManagerFactory beans. I can also configure 2 correspondent JpaTransactionManager beans.
But I don't know how to specify which of them should be used to manage…

Roman
- 64,384
- 92
- 238
- 332
29
votes
3 answers
Making an Entity Framework Model span multiple databases
Is it valid to do something such as
CREATE SYNONYM [dbo].[MyTable] FOR [AnotherDatabase].dbo.[MyTable]
and then modify Entity Framework's edmx file to read this object like it would any other table?
I did a quick sample test and it seems to work…

Rachel
- 130,264
- 66
- 304
- 490
20
votes
6 answers
How to execute my SQL query in CodeIgniter
I have a problem with my query and I need to join two tables from different databases now my problem is how can I execute my query. I got my syntax format from here
Please visit first this link so you could understand why my SQL syntax is like this…

Þaw
- 2,047
- 4
- 22
- 39
18
votes
6 answers
How to create multiple database connections for different databases in java
I have an application which uses four databases in different geographical locations. All the databases contains same tables and only the database name is different according to the location.
I have to create some reports in my application which uses…

Harsha
- 3,548
- 20
- 52
- 75
17
votes
1 answer
Django Multiple Databases Fallback to Master if Slave is down
I have master - slave replication setup for MySQL db backend for Django.
Currently I am reading and writing for Master DB only, but my dashboards are quite query intensive.
I was searching for an option, where in I can Define like…

Joddy
- 2,557
- 1
- 19
- 26
16
votes
5 answers
How to use multiple databases dynamically for one model in CakePHP
Ok, my first question was modified so many times that I chose to delete it and reformulate my question. I've made a small test-case project with different model-names to find a proper solution for my problem.
Warning: Don't mix the databases up with…

Ariaan
- 1,105
- 1
- 9
- 13
14
votes
1 answer
Spring: HibernateTransactionManager handling multiple datasources
In the following piece of code (Spring 3):
@Transactional("txManager")
public class DaoHolder {
@Transactional(value="txManager", readOnly=false, propagation=Propagation.REQUIRES_NEW, rollbackFor={Exception.class})
private void…

machinery
- 3,793
- 4
- 41
- 52
13
votes
1 answer
laravel multiple databases with multiple migration tables
I am trying to set up a multiple database application in laravel 5. I have a database A and a second database B. In database A there are my main models. Now I tried to write a migration file that creates a new table in database B. This works,…

Phil
- 595
- 1
- 3
- 14
13
votes
2 answers
What is the correct way of Multiple inheritance in Qt/C++?
In my Qt application, I have a base class as follow. I am using QObject because I want to use Signal-Slot mechanism in all derived classes.
class IRzPlugin : public QObject {
public:
virtual void registerMenu(QWidget*);
virtual void…

Ashika Umanga Umagiliya
- 8,988
- 28
- 102
- 185
13
votes
2 answers
Refresh the database connection if connection drops or times out
I have a Symfony command line task that has a habit of dropping the mysql connection.
Its a data import task. Which fetches data from multiple connections. Its not one big query but a few smaller ones.
It seems to drop the connection the first time…

Robbo_UK
- 11,351
- 25
- 81
- 117