Odbc Postgres Driver Info
$connString = "Driver=PostgreSQL Unicode;Server=localhost;Database=testdb;Uid=postgres;Pwd=secret;" $conn = New-Object System.Data.Odbc.OdbcConnection($connString) $conn.Open() $cmd = $conn.CreateCommand() $cmd.CommandText = "SELECT datname FROM pg_database" $reader = $cmd.ExecuteReader()
$conn.Close() | Parameter | Description | Default | |-----------|-------------|---------| | Server | PostgreSQL hostname or IP | localhost | | Port | Server port | 5432 | | Database | Database name | same as user | | Uid | Username | OS user | | Pwd | Password | (empty) | | Protocol | Protocol version (6.4, 7.4, 7.5) | 7.4 | | SSLmode | disable, allow, prefer, require | prefer | | UseServerSidePrepare | Enable prepared statements | 0 | | ConnSettings | SQL commands sent on connect | (none) | | Timeout | Connection timeout (seconds) | (infinite) | | CommandTimeout | Query timeout (seconds) | 0 | | ByteaAsLongVarBinary | Handle BYTEA as binary | 0 | | BoolsAsChar | Return boolean as 't'/'f' | 0 | Troubleshooting Common Issues 1. Driver Not Found Symptoms: IM002: [Microsoft][ODBC Driver Manager] Data source name not found odbc postgres driver
Click to verify connectivity, then Save . Manual DSN Configuration (odbc.ini) On Linux/macOS, edit ~/.odbc.ini (user DSN) or /etc/odbc.ini (system DSN): $connString = "Driver=PostgreSQL Unicode
using (OdbcConnection conn = new OdbcConnection(connString)) odbc postgres driver
UseDeclareFetch=1 Fetch=1000 CacheSize=500