Для установки ODBC-драйвера для PostgreSQL выполните следующие действия:
- Найдите драйвер нужной версии на сайте PostgreSQL.
Если вы используете 32-битную версию Конвертума, вам необходимо установить 32-битный драйвер, а для 64-битной версии Конвертума требуется 64-битный драйвер.
- Распакуйте скачанный архив.
- Запустите файл psqlodbc.msi.
- Продолжите установку согласно инструкциям на экране. Вам будет предложено принять лицензионное соглашение.
- Настройте имя пользователя, организацию и выберите тип настройки «Custom».
- Запустите установку.
- После завершения установки в «ODBC Data Source Administrator» должен появится соответствующий драйвер (вы можете найти 32-битный «ODBC Data Source Administrator» в директории C:\Windows\sysWOW64\odbcad32.exe).
Настройте соединение ODBC в соответствии с инструкцией в материале ниже:
Настройка драйвера ODBC
Если у вас есть вопросы, пожалуйста, обращайтесь в нашу службу поддержки: support@convertum.ru
Info
last updated 12/9/2024 12:00:00 AM
Publisher:
PostgreSQL Global Development Group
License:
LGPL-2.0
Dependencies
No dependency information
Share
Devart ODBC Driver for PostgreSQL provides a high-performance and feature-rich connectivity solution for ODBC-compliant applications to access PostgreSQL databases from Windows, macOS, and Linux, both 32-bit and 64-bit. Apple Silicon M1 is supported. Full support for standard ODBC API functions and data types implemented in our driver makes interaction of your application with PostgreSQL fast, easy and extremely handy.
Available in both installer formats, MSI and EXE.
Key Features
Direct Connection
Our connectivity solution enables various ODBC-aware applications to establish a direct connection to PostgreSQL via TCP/IP to eliminate the need for PostgreSQL libraries or clients. Direct connection increases the speed of data transmission between an external application and PostgreSQL, which is crucial for data analysis in real time. It also streamlines the deployment process, since there is no need to distribute any additional libraries or client tools with the driver.
Cost-Effective Deployment
Our ODBC driver is a standalone installation file that doesn’t require the user to deploy and configure any additional software such as a database client or a vendor library. Deployment costs are reduced drastically, especially when using the silent install method with an OEM license in large organizations that have hundreds of machines.
Secure Connection
Work with PostgreSQL securely using SSL connection options provided in our driver along with the support for SSL protocol. You can also connect to PostgreSQL securely via SSH tunnel. SSH protocol is one of the most reliable protocols for data encryption.
Advanced Data Conversion
We have implemented advanced Data Conversion mechanisms that provide bi-directional mapping between any PostgreSQL and ODBC data types.
ODBC Conformance
The driver provides full support for common ODBC interface:
- ODBC API Functions support
- ODBC Data Types support
Additionally, we support Advanced Connection String parameters to allow desktop or web applications to connect to PostgreSQL from various environments and platforms that support ODBC.
Bulk Updates
Moreover, with our driver you can perform bulk updates to PostgreSQL database by combining SQL statements into batches, thus simplifying and speeding up large data modification to PostgreSQL.
PostgreSQL Compatibility
Our driver is compatible with the latest server versions, up to PostgreSQL 13. We also provide compatibility with Microsoft Azure Database for PostgreSQL, Amazon Aurora and Google Cloud for PostgreSQL.
High Performance
Every operation with PostgreSQL becomes significantly faster using such capabilities of our driver as local data caching, connection pooling, and much more.
Support
Visit our Support page to get instant support from experienced professionals, fast and detailed responses, user engagement and interaction, frequent builds with bug fixes, and much more.
Step-by-Step Guide to PostgreSQL ODBC Driver Configuration
Configuring ODBC Driver for PostgreSQL
The ODBC (Open Database Connectivity) driver for PostgreSQL allows applications to connect to a PostgreSQL database using ODBC-compliant interfaces. This article provides a step-by-step guide to installing, configuring, and using the PostgreSQL ODBC driver, with examples and detailed explanations.
What is an ODBC Driver for PostgreSQL?
The PostgreSQL ODBC driver, also known as psqlODBC, enables database connectivity by implementing the ODBC standard. It is essential for applications that rely on ODBC for database access, such as Microsoft Excel, Tableau, or custom applications.
Installing the PostgreSQL ODBC Driver
Step 1: Download the Driver
Download the latest ODBC driver for PostgreSQL from the psqlODBC website.
Step 2: Install the Driver
Windows: Use the .msi installer to install the driver.
Linux: Install using package managers:
sudo apt update sudo apt install odbc-postgresql
Configuring the ODBC Driver
Step 1: Configure the ODBC Data Source
On Windows:
1. Open ODBC Data Source Administrator.
2. Click on Add and select the PostgreSQL ODBC driver.
3. Provide the connection details (host, database name, user, password, port).
On Linux: Modify the odbc.ini and odbcinst.ini files.
Example: odbc.ini
Code:
[PostgreSQL]
Description = PostgreSQL ODBC Data Source
Driver = PostgreSQL
Server = localhost
Port = 5432
Database = mydb
UID = myuser
PWD = mypassword
Example: odbcinst.ini
Code:
[PostgreSQL]
Description = ODBC Driver for PostgreSQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so
Step 2: Test the Connection
Use the isql command-line tool to test the ODBC connection.
Code:
isql -v PostgreSQL
Explanation:
- isql: A utility to verify ODBC data source connections.
- PostgreSQL: The data source name defined in odbc.ini.
Example: Querying PostgreSQL Using ODBC
Python Example:
Code:
import pyodbc
# Define the connection string
connection_string = (
"DRIVER={PostgreSQL};"
"SERVER=localhost;"
"PORT=5432;"
"DATABASE=mydb;"
"UID=myuser;"
"PWD=mypassword;"
)
# Connect to the PostgreSQL database
conn = pyodbc.connect(connection_string)
# Execute a query
cursor = conn.cursor()
cursor.execute("SELECT * FROM my_table")
# Fetch results
for row in cursor.fetchall():
print(row)
# Close the connection
conn.close()
Explanation:
- pyodbc: A Python library to interact with ODBC data sources.
- DRIVER={PostgreSQL}: Specifies the ODBC driver.
- execute(«SELECT * FROM my_table»): Executes a SQL query on the PostgreSQL database.
Advantages of Using ODBC with PostgreSQL
- Cross-Platform Compatibility: ODBC supports multiple platforms and programming languages.
- Standardized Interface: Provides a uniform interface for database connectivity.
- Application Integration: Easily integrates PostgreSQL with tools like Excel, Tableau, and custom applications.
Best Practices:
- Secure Connections: Use SSL/TLS for secure ODBC connections.
- Error Logging: Enable detailed error logging in the ODBC configuration.
- Driver Updates: Regularly update the ODBC driver to the latest version for improved performance and compatibility.
All PostgreSQL Questions, Answers, and Code Snippets Collection.
- Introduction
- Connect to PostgreSQL Server
- Setup ODBC
- Troubleshooting
- More Information
Introduction
This article explains how to connect to PostgreSQL with the official PostgreSQL ODBC driver psqlodbc, when using Windows 10.
It covers the following topics:
- How to connect to postrgreSQL (with code samples).
- How to setup ODBC:
- Configure ODBC using the ODBC Data Source Administrator:
We recommend using system DSNs (available to all users).
- Configure ODBC using the ODBC Data Source Administrator:
Connect to PostgreSQL Server [top]
We strongly recommend using connection objects to connect to databases, and this is what we demonstrate in the code samples.
Follow these steps to connect:
- Create a new channel to try out the code:
- Create a channel like this:
- Name: DB PostgreSQL Connection (or similar)
- Source: From Translator
- Destination: To Channel
- Alternatively use an existing channel:
Your channel will need a From/To Translator or a Filter component.
- Create a channel like this:
- Connect to a database using ODBC:
- Paste this code into the Translator:
If your script uses connection object methods
conn:query{}
orconn:execute{}
to connect to a remote PostgreSQL database, the location of the remote host is specified as part of the name parameter in thedb.connect{ }
command. If you useconn:merge{}
to connect the remote host is specified as part of the name parameter in theconn:merge{}
command itself.function main() local conn = db.connect{ api=db.POSTGRES, name='your_odbc_server_name', user='your_login', password='secret', use_unicode = true, live = true } conn:execute{sql='SELECT * FROM <your table>', live=true} end
- The name is the name of an ODBC source that you create using the ODBC Administrator.
- Paste this code into the Translator:
- Adapt the code to your requirements.
Setup ODBC [top]
Note: Iguana may not always support the very latest version of the PostgreSQL ODBC drivers, so you can simply download an earlier version if necessary. This is particularly true if you are not able to use the the latest version of Iguana.
If you need to know which versions of PostgreSQL are supported by the version of Iguana you are using please contact us at support@interfaceware.com.
To set up a new ODBC data source for PostgreSQL:
- Install the latest PostgreSQL ODBC drivers:
- Download the latest 64 bit driver installer (zipped msi file) from the psqlodbc download site.
- Unzip the file.
- Run the msi installer and accept the defaults.
- Open the 64 bit ODBC Administrator:
Windows 10 (64 bit version) supports 32 and 64 bit ODBC sources — always use the 64 bit ODBC Administrator.
- Open the System DSN tab and click Add:
- Choose the latest PostgreSQL ODBC driver and click Finish:
- Enter the ODBC credentials:
- Use any Data Source and Description you prefer.
- Optional: Choose your default Database.
- Enter the Network Name of the PostgreSQL Server in the Server field:
Note: If you are unsure of the name ask your DBA (database administrator). - Optional: Enter the Port number (default = 5432)
- Enter the User name and Password:
Note: If you are unsure of these ask your DBA (database administrator).
- Test the data source connection:
- If the connection does not work speak to your DBA (database administrator) about how to login to the database (user authentication).
Troubleshooting [top]
- Problems with connection settings:
Speak to your DBA (database administrator) for general connection issues like: User name and password, Database Server network name etc.
- Iguana may not always support the very latest version of the psqlodbc ODBC drivers:
Please contact us at support@interfaceware.com if you need to know the latest supported version of the psqlodbc ODBC drivers.
- Incorrect port number:
SQL Server defaults to port 5432, but a different port can be used. Speak to your database administrator (DBA) or network administrator.
- Using integrated security:
Using integrated security is the usual way to connect to a Microsoft SQL Server database. If this does not work speak to your DBA (database administrator).
If you need more help please contact us at support@interfaceware.com.
More Information [top]
- Using Database Connection Objects
- Forum thread on Windows ODBC
- Using Integrated Authentication, Microsoft SQL Server documentation (kerberos etc)
- Connect to PostgreSQL from Linux or Mac with ODBC