cross-database

LINQ to SQL: Get records from two DB's that are on different servers

荒凉一梦 提交于 2019-12-06 06:32:49
I need to fetch records from tables, that are in two diff. databases in two different SQL Servers. For Instance. Sales DB on server1 and Purchase DB on server2. Both Sales and Purchase DB's have some set of tables say table1 in Sales DB and table2 in Purchase DB. Now, I need to get records from table1 and table2 that are having some common records by joining them. Using T-SQL i can do it by linking the servers and then quering them. Please suggest, how can i do it using LINQ to SQL as am'nt aware of it. Thanks. There are (at least) two possible solutions for this. You could define a stored

performance effect of joining tables from different databases

北战南征 提交于 2019-12-05 11:32:26
问题 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 data), "site2" (for second site specific data), and "general" (for common tables). In which there will be join statements between databases general and site1 and site2. Or should I put all tables in one database? Which is the best practice to do? How

MongoDB cross database query

安稳与你 提交于 2019-12-04 17:16:48
问题 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. Does anyone know the correct syntax to do this? 回答1: To run a command against another database on the same MongoDB server, in the mongo shell you can use: db.getSiblingDB('dbname').collection.command() eg: db.getSiblingDB('test').foo.find() 来源: https:

performance effect of joining tables from different databases

南笙酒味 提交于 2019-12-03 23:32:41
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 data), "site2" (for second site specific data), and "general" (for common tables). In which there will be join statements between databases general and site1 and site2. Or should I put all tables in one database? Which is the best practice to do? How performances differ in each situation? I am using MySQL. So how is the situation especially for MySQL?

Symfony and Doctrine: cross database relations

淺唱寂寞╮ 提交于 2019-12-03 21:03:54
I have two entities Entity1 and Entity2 with a OneToMany relation, but they live in two MySQL databases. How can I implement those entities with their relation in Symfony? Is it possible to create two separated bundles where to implement those entities? In Doctrine, joining data across databases is not technically “supported” by a designed feature, but you can make it work by tricking Doctrine a little bit. If you want to build a relationship between entities then they must use the same connection: same database. The key to getting multiple databases to work is within your entity classes, you

Cross database joins in JPA

眉间皱痕 提交于 2019-12-03 16:27:40
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 queries which span across multiple databases, but I am not sure how to do this with JPA. The @Entity annotations on the Java POJO's don't take the name of the database so there is no way to mark a cross DB relationship. Is there a workaround for this situation? Perhaps using a native query to load the joined entity? We tried out the following approach

MongoDB cross database query

99封情书 提交于 2019-12-03 10:30:34
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. Does anyone know the correct syntax to do this? To run a command against another database on the same MongoDB server, in the mongo shell you can use: db.getSiblingDB('dbname').collection.command() eg: db.getSiblingDB('test').foo.find() 来源: https://stackoverflow.com/questions/13278814/mongodb-cross-database-query

SQl 2008 cross database performance on same physical machine and same server instance

坚强是说给别人听的谎言 提交于 2019-12-02 08:37:09
问题 Is there any performance hit when doing a select across another DB on the same physical machine? So I have 2 databases on the same physical machine running within the same SQL 2008 instance. For instance in SomStoreProc on_this_db I run SELECT someFields FROM the_other_db.dbo.someTable So far from what I have read on the internet, most people seem to indicate NO. 回答1: Even if it is not a performance hit, it could be a problem in data integrity as FKs can't be enforced across databases.

ReflectionException is thrown when mapping entities in Doctrine from different databases

前提是你 提交于 2019-12-01 14:13:56
I'm trying to use Doctrine 2 in a ZF2 application which contains two modules, each with its own database. I need to use cross-database joins so that I can associate entities from one module with entities in another. Here's a UML diagram of the setup. I've tried using this in my first entity (I've removed irrelevant parameters and use statements): namespace Client\Entity; /** * A website. * * @ORM\Entity * @ORM\Table(name="users.website") * ... * @property $server */ class Website extends BaseEntity { // Other class vars ... /** * @ORM\ManyToOne(targetEntity="Server\Entity\Server", inversedBy=

Symfony2 - Doctrine2: Cross-Database Join Column throws Mapping-Exception

喜欢而已 提交于 2019-12-01 08:02:58
Hi want to make a join between two entities. The entities are in different databases: Here is how I set up my database config: doctrine: dbal: default_connection: default connections: default: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database_name% user: %database_user% password: %database_password% charset: UTF8 mapping_types: enum: string data_warehouse: driver: %database_data_warehouse_driver% host: %database_data_warehouse_host% port: %database_data_warehouse_port% dbname: %database_data_warehouse_name% user: %database_data_warehouse_user% password: