简体   繁体   English

配置与Postgres的ODBC连接

[英]Configuring ODBC connection to Postgres

I am tasked with converting a very old Postges/PERL website to SQL Server /C#. 我的任务是将一个非常古老的Postges / PERL网站转换为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). 我已经在桌面上安装了最新版本的Postgres,并已从旧数据库(剪切和粘贴)导入了大多数数据。

Now I am trying to connect to that database using Visual Studio 2008/C#. 现在,我尝试使用Visual Studio 2008 / C#连接到该数据库。

I have downloaded both 32 and 64 bit psqlODBC Postgres drivers. 我已经下载了32位和64位psqlODBC Postgres驱动程序。 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'"). 我可以使用64位驱动程序成功创建和测试用户DSN,但是当我尝试创建ODBC连接(“无法在DLL'kernel32.dll中找到名为'InterlockedIncrement'的入口点时,)在C#代码中出现错误” '“)。

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. 我已经尝试安装和使用32位驱动程序,但是我无法创建DSN-它们未显示在驱动程序列表中,因此我有点受阻。

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 . 如果您要做的就是将PostgreSQL数据库转换为其他数据库引擎,则可以使用pg_dump将整个PostgreSQL数据库导出为文本。 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. 它们可以导出为INSERT ...语句或类似于CSV的COPY格式。 If you will go this way no ODBC is required. 如果您采用这种方式,则不需要ODBC。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM