Connect SQL Server database to PostgreSQL - sql-server

I want to connect a SQL Server database by using pgAdmin4. I already have data in the SQL Server database and want to connect this database in PostgreSQL. I have tried with foreign data also but not working.
If anyone knows the solution it would be really appreciated.

There are two solutions that I've used:
Solution 1: tds_fdw
You can install tds_fdw that is a foreign data wrapper to MSSQL to postgreSQL and, with this foreign data wrapper, you can use your MSSQL tables and schemas as foreign tables inside postgresql. More details here.
As you not provisioned which OS you are using, is better to se inside the project and apply as your needs.
Solution 2: Apache Kafka and Debezium
A little bit complicated than installing a fdw, you can do a streaming replication enabling CDC on MSSQL Server and collecting via Debezium the tables that you need and real-time replicating to you PostgreSQL database connecting via JDBC so, you need what is your scenario and decide what is the best option.

tds_fdw is good, but maybe you should find the windows install package.
Otherwise, if you just want to use one tool that you can query data from both Databases, you should try dbeaver or navicat.

Related

PostgreSQL database not available through Navicat

I'm new to Postgres, not to SQL. I generally use Navicat to connect to my databases, so I've set up a connection to a remote Postgres DB the same way I normally would. I'm able to:
Connect successfully
List databases
When I click on the database with my tables, however, it expands the database but doesn't show anything. No tables.
I saw the other question here, where a user was trying to get into 'template0' and 'template1': Some PostgreSQL databases not visible through clients like Navicat or pgAdmin
I'm not trying to get into these, but into a custom DB full of tables. I've verified that both my web app, and phpPgAdmin can both access all the tables and data, so the issue seems to lie with Navicat.
I read some instructions about how these tables might be 'system items', and went into the Navicat preferences and checked the box that says 'Show system items (PostgreSQL, SQL Server)' to no avail.
One thing I also tried, as I'm using Navicat Premium, is to install the Navicat PostgreSQL version instead. This also yields exactly the same results, I can see my database but none of the tables.
What's going on here?
EDIT
With some great help from Vao Tsun, we determined that this is PostgreSQL 7.2.4 and that it is not supported by Navicat.
https://www.navicat.com/products/navicat-for-postgresql:
Navicat for PostgreSQL connects you to any local/remote PostgreSQL
database servers from version 7.3 or above.
It does not work with PostgreSQL 7.2.4

Remote Link between PostgreSQL and Oracle database

how to create a synonym for a table of a schema in postgresql database on a server into a schema of oracle database on another server?
I have a schema on oracle database on a server and want to create a synonym a table present in a schema of postgresql database on another server.
To create the synonym, we need to have database remote link between these two databases present on two different servers.
How can we do this? Please provide me one solution.
Just to clarify, I believe the question is trying to figure out how to get PostgreSQL data to appear as a table inside of Oracle. (The existing comments seem to be reading it the other way around, in which case, yes, an FDW would be the solution, but in this case that will not work).
In the past (on older versions of Oracle) when we needed this we were forced to build custom replication scripts to transfer data from Postgres into Oracle systems. For a single table, it is pretty straightforward to do with something like Perl & DBI... feel free to substitute that with your favorite scripting language.
On newer Oracle systems, I believe you can use Oracle Database Gateway to accomplish this. I am not sure if they support Postgres directly, but they do support ODBC (and I think JDBC) which should work. Here is an example blog post setting this up with MSSQL (http://oracle-help.com/oracle-database/installation-oracle-database-gateway/), the process should be similar for Postgres.
Hope this helps!

Database mirroring

I'm designing a CRM for a company with 3 branches. the connection between these 3 branches is not reliable (with a vpn over internet). so we decided to setup a local server with SqlServer Database in each one and configure these DBs in the way that whenever a client inserted data into any of these DBs it automatically insert it into other ones. How could I do this?
and my programming language is C# if it would help!
You could use SQL Server replication, more specifically Merge Replication
See http://technet.microsoft.com/en-us/library/ms152746.aspx

Converting SQL Server 2012 schema to PostgreSQL 9.1

For a new project we have to export data from a SQL Server 2012 database to a PostgreSQL database. We have the SQL Server schema but have to create one for PostgreSQL. As far as possible we would like the schemas to match. Can anyone give any advice on the best way of converting a SQL Server schema to a PostgreSQL one? Are there any tools or scripts which will help? I have seen a PostgreSQL function but to be honest I have no PostgreSQL experience and our remit stops at the data being imported into PostgreSQL so I would like to do everything from the SQL Server side (planning to use SSIS with the 64-bit ODBC driver for PostgreSQL to export the data once we have the schema created)
Although not free, I've used Toad Data Modeler for this in the past. We never used it on any particularly complex schemas, but it did do a good job of keeping schemas in sync between various DB platforms.
Your mileage may vary, but it's worth a look.
I don't know a direct schema converter but most data modeling tools offer such conversion functionality. We use Dezign for Databases. This tool has got a function "switch target dbms". This a data modeling tool just like Toad Data Modeler mentioned here before. With the database independent modeling functionality you can keep schemas on different db platforms in sync. For data synchronization (data pump) between different database platforms you can use DataDiff CrossDB.

Replication across heterogenous databases

Is it possible using SQL Server Replication to replicate data to AND from (bi-directional) Oracle and SQL Server? The schemas are completely different. In real-time would be a bonus.
Have already investigated Oracle Golden Gate, which seemed to do the job, although the licence cost is not insignificant!
I wondered if anyone has had any experience in replicating data across different schemas, and what other tools they employed? I realise this is a bit of an open-ended question but any advice and previous experiences would be most useful.
Thanks
Duncan
I recently had to create a solution to import periodically lots of data from different databases (most of the time from Oracle databases) to a SQL Server database (a data warehouse). To do so, I used SQL Server Integration Service to create a package able to import, transform and insert the data as I wanted (since it was from heterogeneous sources too). This software comes with SQL Server and the version 2005 and superior is really easy to use (graphical programming). In your case, you could trigger your created services when needed. I am not sure it is the best solution since you would need to create a SSIS service for each direction (from Oracle to SQL Server and from SQL Server to Oracle).

Resources