0

I am tasked with converting a very old Postges/PERL website to SQL Server /C#.

I have installed a current version of Postgres on my desktop and have imported most of the data from the old database (cut and paste).

Now I am trying to connect to that database using Visual Studio 2008/C#.

I have downloaded both 32 and 64 bit psqlODBC Postgres drivers. I can successfully create and test a user DSN using the 64 bit drivers, but I get an error in my C# code when I try to create the ODBC connection ("Unable to find an entry point named 'InterlockedIncrement' in DLL 'kernel32.dll'").

I have tried to install and use the 32 bit drivers, but I cannot create a DSN - they don't show up in the driver list, so I am a bit stuck.

2
  • 1
    I found this page - the last step has detailed instructions. I'm not sure if it will work for you or not, but I thought I'd post it in case it helps. Commented Jan 12, 2011 at 23:00
  • I hope you have installed both 32 and 64 bit version of PostgreSQL drivers? Was there any errors while installing 32 bit version? Commented Jan 14, 2011 at 20:01

1 Answer 1

1

If all you have to do is to convert that PostgreSQL database to other db engine then you can export whole PostgreSQL database to text using pg_dump. There is possibility to export schema only, and then you can export data from interesting tables. They may be exported as INSERT ... statements or as COPY format similar to CSV. If you will go this way no ODBC is required.

Sign up to request clarification or add additional context in comments.

3 Comments

I have managed to export all the data from the old database. The problem is with importing it to the current version of Postgres. PgAdmin III's SQL tool hangs PgAdmin, and the PSQL client used to be able to import as many as 5000 rows in a single script, but now it chokes on 300. So there is something fundamentally wrong with either the engine itself or the way I have it configured. I also have an ongoing need to be able to access the data while I am converting the site, so an ODBC driver seems to be a needed part of the solution.
Have you exported the data to text by pg_dump? If so you can start converting CREATE TABLE ... to use types specific to SQL Server, and made similar operation for INSERT INTO... or COPY .... AFAIK they differ in some types and in some formats, for example datetime format is very different.
when moving data, use the new version of pg_dump to dump data from your old version of Postgresql.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.