Can you connect to two postgres databases in Springboot? - postgresql

If yes, how?
I am writing a archival project where old data from one database has to be moved to another. For this, I need to connect to two database in a springboot project.
Any pointers would be appreciated.

You need to provide two different DataSources (two different beans).
Take a look at http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-two-datasources

Related

How to connect Apollographql to multiple Postgres databases

I would like to use Apollographql to connect multiple Postgres databases which share the same structures (tables, columns). The idea was having a single endpoint to access any of these databases (using namespaces), but I couldn't find in the documentation how to do this.
I need a bit of your wisdom guys, how can Apollo connect to multiple Postgres databases using different namespaces? Is there another app better suited for this kind of requirements?

Suitecrm Database schema for multiple companies

How can I separate database using suitecrm.
In My application there is one source code and i want to company wise separate database.
Please help me.
You might need to use seperate installations for keeping them seperate.
Additionally, you can use $sugar_config['db'] variable to dynamically connect with a database of your choice.

Multiple server instance load and database balancing

Please correct me if I am wrong but I guess handling more requests and load by adding more machines or balancing the load between multiple servers is horizontal scaling. So, if I add more servers, how do I distribute the database? Do I create only one database to hold the user records with multiple servers? Or do I split the database too? Then what about database integrity? How to synchronize it? I am a newbie and really confused but eager to learn. I would like to use postgresql for my project and would like to know some basic things before I start. What I want to do is, create two servers for the application load balancing (please correct me if its not what I have to do). How will I manage the database across these without database integrity? Do I have to replicate the data within the two servers? How do you guyz have multiple instance and manage database? Do I need to go through sharding for this? What would be the best approach to have many instance without database integrity in accordance to postgresql. I would really appreciate if anyone could explain it to me. Thank you!
Not sure if you are looking just for a service, which could bring you what you need so you don't have to spend time on it, or if on the other hand, you would like to implement that on your end, which I guess could be quite complex.
If you are looking for your own solution, maybe you should take a look at Postgres-XC, which is a group that provides a database cluster based upon PostgreSQL database.
On the other hand, if you are just interested in the development process and don't want to spend time on this when you can have it on the cloud, maybe you would like to take a look at EnterpriseDB which provides PostgreSQL on the cloud.
For your application, you can also use a cloud service in which you can even auto-scale your app depending on some parameters as it is explained here.

How to work with multiple databases in entity-framework?

I'm working with entity-framework and MVC and i have two databases in the same server.
I just want to do a select in a table in the "database1" then do another select in a table in the "database2" in the same code but i don't know how to configure two diferent databases in my project.
Can someone show me how to configure it to do this? and how to use it in the code?
You have to setup your connection in your database initilizer. In EF6 you have a good support for multiple databases.
Check this link: Using entity framework on multiple databases

Merging two database into single database

I have deployed same application in two different computers. Now i need to merge both data from two different database into single database.
The application is developed using c# .net and uses sql express 2008.
The problem arised because i could not use the application over LAN.
So i need to merge the two database into one.
So please help me to solve the problem to merge it.
I also need to run the application over LAN but the sqlbrowser doesnot start and i have searched the internet for the answer but i haven't been lucky.
thank you, waiting for response.
The approach you want to take will depend largely on your schema, but Microsoft Sync Framework should likely be useful. It would let you define rules for resolving conflicts and merging your data.
As for accessing your data over the LAN, this post has a good overview of what it takes to enable remote access to your SQL Server Express.