Skip to content

Commit b20f608

Browse files
authored
Update ODBC instructions for Connect SE and update ODBC result file (#2284)
* ODBC Connect cosmetic fixes - Update command for connection for default `peer` authentication for user `postgres` (unless changed in `pg_hba.conf`). - Update command for privilege to be more verbose. - Update path for `.sql` file - Update instructions for `pg_hba.conf` file to use unix socket (`local`) type as well as TCP/IP type `host`. - Update instruction about usage of user dsn (data source file) over system dsn. - Update path of `odbc-postgresql` driver path in comment * Connect SE: update ODBC result file
1 parent 5f25a91 commit b20f608

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

storage/connect/mysql-test/connect/r/odbc_postgresql.result

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Table Create Table
22
t1 CREATE TABLE `t1` (
33
`Name` varchar(256) NOT NULL,
44
`Description` varchar(256) DEFAULT NULL
5-
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources'
5+
) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `TABLE_TYPE`='ODBC' `CATFUNC`='Sources'
66
SET NAMES utf8;
77
#
88
# Checking CATFUNC=Tables
@@ -157,7 +157,7 @@ SHOW CREATE TABLE t1;
157157
Table Create Table
158158
t1 CREATE TABLE `t1` (
159159
`a` int(10) NOT NULL
160-
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC'
160+
) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC'
161161
SELECT * FROM t1;
162162
a
163163
10
@@ -168,7 +168,7 @@ SHOW CREATE TABLE t2;
168168
Table Create Table
169169
t2 CREATE TABLE `t2` (
170170
`a` int(10) NOT NULL
171-
) ENGINE=MyISAM DEFAULT CHARSET=latin1
171+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
172172
SELECT * FROM t2;
173173
a
174174
10
@@ -189,7 +189,7 @@ SHOW CREATE TABLE t1;
189189
Table Create Table
190190
t1 CREATE TABLE `t1` (
191191
`a` int(10) NOT NULL
192-
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='public.t1'
192+
) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='public.t1'
193193
SELECT * FROM t1;
194194
a
195195
10
@@ -202,7 +202,7 @@ SHOW CREATE TABLE t1;
202202
Table Create Table
203203
t1 CREATE TABLE `t1` (
204204
`a` char(10) NOT NULL
205-
) ENGINE=CONNECT DEFAULT CHARSET=utf8mb3 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t1' `DATA_CHARSET`='utf8'
205+
) ENGINE=CONNECT DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t1' `DATA_CHARSET`='utf8'
206206
SELECT * FROM t1;
207207
a
208208
aaa
@@ -213,8 +213,8 @@ CREATE TABLE t2 AS SELECT * FROM t1;
213213
SHOW CREATE TABLE t2;
214214
Table Create Table
215215
t2 CREATE TABLE `t2` (
216-
`a` char(10) CHARACTER SET utf8mb3 NOT NULL
217-
) ENGINE=MyISAM DEFAULT CHARSET=latin1
216+
`a` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
217+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
218218
SELECT * FROM t2;
219219
a
220220
aaa
@@ -237,7 +237,7 @@ SHOW CREATE TABLE t1;
237237
Table Create Table
238238
t1 CREATE TABLE `t1` (
239239
`a` char(10) DEFAULT NULL
240-
) ENGINE=CONNECT DEFAULT CHARSET=utf8mb3 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.v1' `DATA_CHARSET`='utf8'
240+
) ENGINE=CONNECT DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.v1' `DATA_CHARSET`='utf8'
241241
SELECT * FROM t1;
242242
a
243243
aaa
@@ -248,8 +248,8 @@ CREATE TABLE t2 AS SELECT * FROM t1;
248248
SHOW CREATE TABLE t2;
249249
Table Create Table
250250
t2 CREATE TABLE `t2` (
251-
`a` char(10) CHARACTER SET utf8mb3 DEFAULT NULL
252-
) ENGINE=MyISAM DEFAULT CHARSET=latin1
251+
`a` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL
252+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
253253
SELECT * FROM t2;
254254
a
255255
aaa
@@ -272,7 +272,7 @@ SHOW CREATE TABLE t1;
272272
Table Create Table
273273
t1 CREATE TABLE `t1` (
274274
`a` char(10) NOT NULL
275-
) ENGINE=CONNECT DEFAULT CHARSET=utf8mb3 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t2' `DATA_CHARSET`='utf8'
275+
) ENGINE=CONNECT DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t2' `DATA_CHARSET`='utf8'
276276
SELECT * FROM t1;
277277
a
278278
xxx
@@ -283,8 +283,8 @@ CREATE TABLE t2 AS SELECT * FROM t1;
283283
SHOW CREATE TABLE t2;
284284
Table Create Table
285285
t2 CREATE TABLE `t2` (
286-
`a` char(10) CHARACTER SET utf8mb3 NOT NULL
287-
) ENGINE=MyISAM DEFAULT CHARSET=latin1
286+
`a` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
287+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
288288
SELECT * FROM t2;
289289
a
290290
xxx

storage/connect/mysql-test/connect/t/odbc_postgresql.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- The SQL script to create PostgreSQL data for odbc_postgresql.test
33
--
44
-- Run this script as a admin user:
5-
-- psql -U postgres < odbc_postgresql.sql
5+
-- sudo -u postgres psql < storage/connect/mysql-test/connect/t/odbc_postgresql.sql
66

77
SET NAMES 'UTF8';
88

@@ -11,7 +11,7 @@ DROP USER IF EXISTS mtr;
1111

1212
CREATE USER mtr WITH PASSWORD 'mtr';
1313
CREATE DATABASE mtr OWNER=mtr ENCODING='UTF8';
14-
GRANT ALL ON DATABASE mtr TO mtr;
14+
GRANT ALL PRIVILEGES ON DATABASE mtr TO mtr;
1515
\c mtr
1616
SET role mtr;
1717
CREATE TABLE t1 (a INT NOT NULL);
@@ -27,4 +27,4 @@ CREATE TABLE schema1.t2 (a CHAR(10) NOT NULL);
2727
INSERT INTO schema1.t2 VALUES ('xxx'),('yyy'),('zzz'),('ÄÖÜ');
2828
CREATE TABLE schema1.t3 (a CHAR(10) NOT NULL, b CHAR(10) NOT NULL);
2929
INSERT INTO schema1.t3 VALUES ('xxx', 'aaa'),('yyy', 'bbb'),('zzz', 'ccc'),('ÄÖÜ', 'яяя');
30-
30+
\dt schema1.*

storage/connect/mysql-test/connect/t/odbc_postgresql.test

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# To configure your system to be able to run this test,
66
# follow through the following steps:
77
#
8-
# 1. Install and configure PostgreSQL database to stat on the system startup
8+
# 1. Install and configure PostgreSQL database to start on the system startup
99
#
1010
# 2. Create user, database, schema and tables to be used by mtr:
11-
# psql -U postgres < odbc_postgresql.sql
11+
# sudo -u postgres psql < storage/connect/mysql-test/connect/t/odbc_postgresql.sql
1212
#
1313
# 3. Install PostgreSQL ODBC Driver.
1414
# - On CentOS, Fedora:
@@ -18,18 +18,23 @@
1818
#
1919
# 4. Create a data source with the name "ConnectEnginePostgresql"
2020
# - On Windows: use odbcadm.exe
21-
# - On Linux: put these lines into /etc/odbc.ini
21+
# - On Linux: put these lines into /etc/odbc.ini or in ~/.odbc.ini
2222
#
2323
#[ConnectEnginePostgresql]
2424
#Description=PostgreSQL DSN for ConnectSE
25-
#Driver=PostgreSQL (should the path to the driver so file)
25+
#Driver=PostgreSQL (should the path to the driver so file, on linux: /usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so)
2626
#Database=mtr
2727
#Servername=localhost
2828
#Port=5432
2929
#
3030
# 5. Allow user "mtr" to connect to the database "mtr"
31-
# Add this line into the begginning of pg_hba.conf
32-
# (usually /var/lib/pgsql/data/pg_hba.conf on Linux):
31+
# Find `pg_hba.conf` file:
32+
# Run `SHOW hba_file;` or `locate pg_hba.conf` to find right location
33+
# (usually /var/lib/pgsql/data/pg_hba.conf or /etc/postgresql/[version]/main/pg_hba.conf on Linux)
34+
# Add this line into the beginning of pg_hba.conf:
35+
# For unix socket connection (connect with `psql -U mtr`)
36+
#local mtr mtr password
37+
# For TCP/IP connection (connect with `psql -U mtr -h 127.0.0.1`)
3338
#host mtr mtr 127.0.0.1/32 password
3439
#
3540
# 6. Restart the server:

0 commit comments

Comments
 (0)