Skip to content

Commit 0614231

Browse files
committed
Driver/ODBC: Implement suggestions by CodeRabbit
1 parent 3d7f82e commit 0614231

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

docs/connect/odbc/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ OdbcConnection connection = new OdbcConnection(connection_string);
4747
connection.Open();
4848

4949
// Invoke query
50-
OdbcCommand command = new OdbcCommand("SELECT mountain, height FROM sys.summits ORDER BY height DESC LIMIT 5");
50+
OdbcCommand command = new OdbcCommand("SELECT mountain, height FROM sys.summits ORDER BY height DESC LIMIT 5", connection);
5151
OdbcDataReader reader = command.ExecuteReader();
5252

5353
// Display results
54-
while(reader.Read())
54+
while(reader.Read())
5555
{
56-
String mountain = reader.GetString(0);
57-
Integer height = reader.GetString(1);
56+
String mountain = reader.GetString(0);
57+
int height = reader.GetInt32(1);
5858
Console.Write(mountain + ": " + height);
5959
Console.WriteLine();
6060
}
@@ -188,7 +188,7 @@ cn.Close
188188

189189

190190
[.NET Framework Data Provider for ODBC]: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/data-providers#net-framework-data-provider-for-odbc
191-
[Connecting to PostgreSQL with pyodbc]: https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-PostgreSQL
191+
[connecting to PostgreSQL with pyodbc]: https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-PostgreSQL
192192
[Erlang ODBC application]: https://www.erlang.org/docs/28/apps/odbc/odbc.html
193193
[psqlODBC with Visual Basic]: https://odbc.postgresql.org/howto-vb.html
194194
[pyodbc]: https://github.com/mkleehammer/pyodbc

docs/connect/odbc/setup-body.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The PostgreSQL ODBC driver is called [psqlODBC].
1111

1212
:Windows:
1313

14-
On Windows, download the latest 64 bit driver installer
14+
On Windows, download the latest 64-bit driver installer
1515
(MSI file) from the [psqlODBC download site] and invoke it.
1616
[Installing PostgreSQL ODBC Drivers] includes a walkthrough
1717
including screenshots.
@@ -57,8 +57,10 @@ odbcinst -i -d -f odbcinst.ini
5757
A typical connection string for CrateDB is:
5858

5959
```text
60-
ODBC;Driver={PostgreSQL ODBC};Server=localhost;Port=5432;Uid=crate;Pwd=crate;MaxVarcharSize=1073741824
60+
ODBC;Driver={PostgreSQL ODBC};Server=localhost;Port=5432;Uid=crate;Pwd=crate;MaxVarcharSize=1073741824
6161
```
6262

63+
For some drivers, you will need to omit the `ODBC;` prefix.
64+
6365

6466
[Installing PostgreSQL ODBC Drivers]: https://help.campbellsci.com/PC400%20Manual/viewpro/installing_postgresql_odbc_drivers.htm

0 commit comments

Comments
 (0)