Excel连接Postgresql读取数据
Excel链接Postgresql读取数据
下载ODBC驱动
- Mysql的ODBC驱动,下载地址:https://dev.mysql.com/downloads/connector/odbc/
- Postgresql的ODBC驱动,下载地址:https://www.postgresql.org/ftp/odbc/versions/msi/
添加用户DSN
- 根据你的版本选择32/64位的ODBC数据源进行设置,可通过控制面板-管理工具进入到这个界面:
- 打开ODBC 数据源(64位)-(注意:数据库编码格式为utf8的请选择Unicode的版本)
- 连接数据库(Postgresql的界面不同,但原理一样)
使用数据源
- 添加查询连接:
- 选择数据源并填入SQL:
- 加载数据
常见错误
- 驱动安装版本错误,此时如果你下载的是64位ODBC驱动,那么将32位的下载了即可
- 如果安装驱动的过程中提示这个情况,将Visual Studio 2019安装后再将驱动安装就可以了,下面是各个版本的必要组件库下载路径,直接复制下载就可以了
Microsoft Visual C++ Redistributable 2019
x86: https://aka.ms/vs/16/release/VC_redist.x86.exe
x64: https://aka.ms/vs/16/release/VC_redist.x64.exe
Microsoft Visual C++ Redistributable 2017
x86: https://go.microsoft.com/fwlink/?LinkId=746571
x64: https://go.microsoft.com/fwlink/?LinkId=746572
Microsoft Visual C++ Redistributable 2015
x86+x64: https://www.microsoft.com/en-pk/download/details.aspx?id=48145
x86+x64 update3: https://www.microsoft.com/en-us/download/details.aspx?id=53587
Microsoft Visual C++ Redistributable 2013
x86+x64 in all Language: https://support.microsoft.com/en-us/help/4032938/update-for-visual-c-2013-redistributable-package
Microsoft Visual C++ Redistributable 2012
x86+x64 in all Language: https://my.visualstudio.com/Downloads?pid=1452
Microsoft Visual C++ Redistributable 2010
x86-sp1: https://www.microsoft.com/en-pk/download/details.aspx?id=8328
x86-sp1-MFC-sec-update: https://www.microsoft.com/en-us/download/details.aspx?id=26999
Microsoft Visual C++ Redistributable 2008
x86: https://www.microsoft.com/en-us/download/details.aspx?id=29
x64: https://www.microsoft.com/en-us/download/details.aspx?id=15336
x86+x64-MFC-update: https://www.microsoft.com/en-us/download/details.aspx?id=26368
Microsoft Visual C++ Redistributable 2005
x86: https://www.microsoft.com/en-pk/download/details.aspx?id=3387
x64: https://www.microsoft.com/en-US/Download/confirmation.aspx?id=21254