Questions tagged [cross-database]
93 questions
25
votes
4 answers
Cross database querying in EF
Is there any way to implement cross database querying in Entity Framework? Let's imagine I've two Entities User and Post, User entity is in database1 and Post is in database2, which means those entities are in separate databases. How should I get…

Saber Amani
- 6,409
- 12
- 53
- 88
25
votes
1 answer
MongoDB cross database query
I know I've seen this solution somewhere, but I can't seem to find it now. I'm trying to query one MongoDB database while connected to another. This should be possible without explicitly connecting to the other database before running the query. …

jbl429
- 251
- 1
- 3
- 3
22
votes
3 answers
PostgreSQL copy/transfer data from one database to another
I need to copy data from one table to another. the two tables have almost the same structure, but are in different databases.
i tried
INSERT INTO db1.public.table2(
id,
name,
adress,
lat,
lng
)
SELECT
id,
name,
adress,
lat
…

fabvys
- 413
- 1
- 5
- 12
19
votes
2 answers
Performance effect of joining tables from different databases
I have a web site using a database named lets say "site1". I am planning to put another site on the same server which will also use some of the tables from "site1".
So should I use three different databases like "site1" (for first site specific…

Mucahit Sancar Kahveci
- 343
- 1
- 2
- 8
9
votes
1 answer
Mysql cross-database foreign key
I am trying to create a cross database foreign key. When I run the following code on the same database
CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`int_id` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
…

sagibb
- 956
- 2
- 9
- 21
7
votes
3 answers
EF4 cross database relationships
I was wondering if EF4 support cross-databse relationships? For instance:
db1
Author
Id
Name
db2
Posts
Id
Content
db1.Author.Id
What ideally I need to do to get this relation in my ef4 model?
Do you guys have any idea?
Thanks

Daniel
- 455
- 4
- 14
7
votes
1 answer
EntityFramework: Retrieve data with a condition on two different context
I'm importing data between two different database(which have not the same context).
So I've two different context. The goal is to import some data of the context A to the context B.
Data in the context B are never directly edited, they are only…

J4N
- 19,480
- 39
- 187
- 340
6
votes
3 answers
Cross database joins in JPA
Is it possible to do cross database table joins in JPA?
I have a users table in one database which has a foreign key to a organizations table in a separate database. Both the databases are on same physical machine. Now MySQL allows me to write…

Abhinav Sarkar
- 23,534
- 11
- 81
- 97
6
votes
1 answer
Cross Database foreign key error
This my model of first Database DB1:
from django.db import models
class Company(models.Model):
name = models.CharField(max_length=100, null=True)
address = models.TextField(max_length=200, null=True)
…

Shivratna
- 190
- 2
- 11
5
votes
2 answers
Is there any shortcut for using dblink in Postgres?
In Postgres, you can link to your other databases using dblink, but the syntax is very verbose. For example you can do:
SELECT *
FROM dblink (
'dbname=name port=1234 host=host user=user password=password',
'select * from table'
) AS…

Joe
- 7,922
- 18
- 54
- 83
5
votes
1 answer
Building queries with a cross database join using SQLalchemy ORM and SQLite
I have two SQLite databases containing tables I need to join using SQLalchemy. For reasons I can not combine all the tables into one SQLite database. I am using SQLalchemy ORM. I have not been able to find any solution online that meets my specific…

John van Dam
- 393
- 2
- 9
4
votes
1 answer
Codeigniter Datamapper Cross-Database Joins
Good morning,
I am currently working on a project that utilises Codeigniter and the Datamapper Library (http://datamapper.wanwizard.eu). The project uses a central database for user data (called "base") and a seperate database for the application…

Daniel Greaves
- 987
- 5
- 24
4
votes
1 answer
How to join tables from two different databases using sqlalchemy expression language / sqlalchemy core?
I am using MySql. I was however able to find ways to do this using sqlalchemy orm but not using expression language.So I am specifically looking for core / expression language based solutions. The databases lie on the same server
This is how my…

Indhuja Ravi
- 43
- 1
- 6
4
votes
1 answer
Avoiding the use of SET TRUSTWORTHY ON
I'm working with a system which had to create objects in one database based on objects being created in another database. The objects are not duplicates, so I can't simply replicate the objects.
I have code below which gives a simplified…

Tom H
- 46,766
- 14
- 87
- 128
4
votes
1 answer
How to use different datasources in a Query using cakephp3?
I'm working on a cakePHP3 project which does have 3 different datascources. I have one main model, called application, which should have two hasOne() associations to two models with a different datascource as Model Application. I have created the…

Seb
- 145
- 1
- 13