Skip to content

Commit 3c6b388

Browse files
committed
Fix tests with ODBC MySQL driver
Squashed commit of the following: commit 9cc5b01e558b6ab9de4ab23fac5ab9c7d65dd2c3 Author: amochin <mochinin@gmail.com> Date: Sun Feb 2 17:49:49 2025 +0100 ODBC Driver 9.2 - proper error message commit 540c403 Author: amochin <mochinin@gmail.com> Date: Sun Feb 2 17:40:16 2025 +0100 ODBC Driver 9.2 everywhere commit ebb4db9 Author: amochin <mochinin@gmail.com> Date: Sun Feb 2 17:30:15 2025 +0100 ODBC Driver 9.2 commit d7ac4fc Author: amochin <mochinin@gmail.com> Date: Sun Feb 2 17:26:20 2025 +0100 Install unixodbc commit f1ee4d2 Author: amochin <mochinin@gmail.com> Date: Sun Feb 2 17:21:19 2025 +0100 Follow redirect in curl command commit 13efbf3 Author: amochin <mochinin@gmail.com> Date: Sun Feb 2 17:16:29 2025 +0100 Different artifact files commit 1f3ef96 Author: amochin <mochinin@gmail.com> Date: Sun Feb 2 17:08:01 2025 +0100 Upload artifact v4 commit f24d440 Author: amochin <mochinin@gmail.com> Date: Fri Jan 31 14:39:29 2025 +0100 Try connector for earlier Ubuntu version and DPKG commit 723cee1 Author: amochin <mochinin@gmail.com> Date: Thu Jan 30 11:27:07 2025 +0100 Forgot the dollar sign commit 5fa817b Author: amochin <mochinin@gmail.com> Date: Thu Jan 30 11:19:44 2025 +0100 Add quotes to resolve the variable commit 5b6a5ec Author: amochin <mochinin@gmail.com> Date: Thu Jan 30 11:17:28 2025 +0100 Download driver package and use apt-get to install it commit 344cf47 Author: amochin <mochinin@gmail.com> Date: Thu Jan 30 11:05:39 2025 +0100 Try apt-get to install the ODBC driver commit dc6e05f Author: amochin <mochinin@gmail.com> Date: Thu Jan 30 10:57:53 2025 +0100 Revert "Try copilot's way to install the ODBC driver" This reverts commit 9fa0912. commit 9fa0912 Author: amochin <mochinin@gmail.com> Date: Thu Jan 30 10:55:32 2025 +0100 Try copilot's way to install the ODBC driver commit 70a17b6 Author: amochin <mochinin@gmail.com> Date: Thu Jan 30 10:40:28 2025 +0100 Remove unnecessary debug outputs commit f28b75f Author: amochin <mochinin@gmail.com> Date: Wed Jan 29 14:44:35 2025 +0100 Check MySQL ODBC driver file exists - in extra job commit 5b51e66 Author: amochin <mochinin@gmail.com> Date: Wed Jan 29 14:39:29 2025 +0100 Check MySQL ODBC driver file exists commit fa90fca Author: amochin <mochinin@gmail.com> Date: Wed Jan 29 14:38:51 2025 +0100 Revert "Check MySQL ODBC driver file exists" This reverts commit a6f6ce4. commit 383d87e Merge: 2ab8141 a6f6ce4 Author: amochin <mochinin@gmail.com> Date: Wed Jan 29 14:37:26 2025 +0100 Merge branch 'fix-ci' of https://github.com/MarketSquare/Robotframework-Database-Library into fix-ci commit 2ab8141 Author: amochin <mochinin@gmail.com> Date: Wed Jan 29 14:37:14 2025 +0100 Check MySQL ODBC driver file exists commit a6f6ce4 Author: amochin <mochinin@gmail.com> Date: Wed Jan 29 14:35:07 2025 +0100 Check MySQL ODBC driver file exists
1 parent 85e1a6a commit 3c6b388

File tree

11 files changed

+29
-31
lines changed

11 files changed

+29
-31
lines changed

.github/workflows/common_tests.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111

1212
# options for pyodbc only
1313
DB_CHARSET: utf8mb4
14-
DB_DRIVER: "{MySQL ODBC 8.0 ANSI Driver}"
14+
DB_DRIVER: "{MySQL ODBC 9.2 ANSI Driver}"
1515

1616
jobs:
1717
tests:
@@ -81,6 +81,11 @@ jobs:
8181
- 3306:3306
8282

8383
steps:
84+
85+
- name: Install unixodbc
86+
if: matrix.py_db_module == 'pyodbc'
87+
run: sudo apt-get update && sudo apt-get install -y unixodbc
88+
8489
- name: Install ODBC driver for PostgreSQL
8590
if: matrix.py_db_module == 'pyodbc'
8691
run: |
@@ -97,22 +102,15 @@ jobs:
97102
if: matrix.py_db_module == 'pyodbc'
98103
run: |
99104
cd "$RUNNER_TEMP"
100-
echo "*** download driver zip file"
101-
curl --silent --show-error --write-out "$CURL_OUTPUT_FORMAT" -O "https://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/Connector-ODBC/8.0/${MYSQL_DRIVER}.tar.gz"
102-
ls -l "${MYSQL_DRIVER}.tar.gz"
103-
tar -xz -f "${MYSQL_DRIVER}.tar.gz"
104-
echo "*** copy driver file to /usr/lib"
105-
sudo cp -v "${MYSQL_DRIVER}/lib/libmyodbc8a.so" /usr/lib/x86_64-linux-gnu/odbc/
106-
sudo chmod a+r /usr/lib/x86_64-linux-gnu/odbc/libmyodbc8a.so
107-
echo "*** create odbcinst.ini entry"
108-
echo '[MySQL ODBC 8.0 ANSI Driver]' > mysql_odbcinst.ini
109-
echo 'Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc8a.so' >> mysql_odbcinst.ini
110-
echo 'UsageCount = 1' >> mysql_odbcinst.ini
111-
echo 'Threading = 2' >> mysql_odbcinst.ini
112-
sudo odbcinst -i -d -f mysql_odbcinst.ini
105+
echo "*** download driver"
106+
curl --silent --show-error --write-out "$CURL_OUTPUT_FORMAT" -O -L "https://dev.mysql.com/get/Downloads/Connector-ODBC/9.2/${MYSQL_DRIVER}"
107+
ls -l "${MYSQL_DRIVER}"
108+
echo "*** install the driver"
109+
sudo dpkg -i "./${MYSQL_DRIVER}"
110+
sudo apt-get install -f
113111
env:
114-
CURL_OUTPUT_FORMAT: '%{http_code} %{filename_effective} %{size_download} %{time_total}\n'
115-
MYSQL_DRIVER: mysql-connector-odbc-8.0.22-linux-glibc2.12-x86-64bit
112+
CURL_OUTPUT_FORMAT: '%{http_code} %{filename_effective} %{size_download} %{time_total}\n'
113+
MYSQL_DRIVER: mysql-connector-odbc_9.2.0-1ubuntu24.04_amd64.deb
116114

117115
- name: Check ODBC setup
118116
if: matrix.py_db_module == 'pyodbc'
@@ -149,7 +147,7 @@ jobs:
149147

150148
run: |
151149
pip install ${{ matrix.pip_install }}
152-
150+
153151
- name: Tests for ${{ matrix.job_name }}
154152
working-directory: ./test
155153
run: >-
@@ -173,7 +171,7 @@ jobs:
173171
174172
- name: Upload Robot Logs
175173
if: ${{ always() }}
176-
uses: actions/upload-artifact@v3
174+
uses: actions/upload-artifact@v4
177175
with:
178-
name: log-files
176+
name: log-files-${{ matrix.job_name }}
179177
path: ./test/results/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Connect To Database
226226
... db_password=pass
227227
... db_host=127.0.0.1
228228
... db_port=3306
229-
... odbc_driver={MySQL ODBC 8.0 ANSI Driver}
229+
... odbc_driver={MySQL ODBC 9.2 ANSI Driver}
230230
231231
# Specifying a custom charset if needed
232232
Connect To Database
@@ -236,7 +236,7 @@ Connect To Database
236236
... db_password=pass
237237
... db_host=127.0.0.1
238238
... db_port=3306
239-
... odbc_driver={MySQL ODBC 8.0 ANSI Driver}
239+
... odbc_driver={MySQL ODBC 9.2 ANSI Driver}
240240
... db_charset=latin1
241241
```
242242
</details>

src/DatabaseLibrary/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class DatabaseLibrary(ConnectionManager, Query, Assertion):
211211
| ... db_password=pass
212212
| ... db_host=127.0.0.1
213213
| ... db_port=3306
214-
| ... odbc_driver={MySQL ODBC 8.0 ANSI Driver}
214+
| ... odbc_driver={MySQL ODBC 9.2 ANSI Driver}
215215
|
216216
| # Specifying a custom charset if needed
217217
| Connect To Database
@@ -221,7 +221,7 @@ class DatabaseLibrary(ConnectionManager, Query, Assertion):
221221
| ... db_password=pass
222222
| ... db_host=127.0.0.1
223223
| ... db_port=3306
224-
| ... odbc_driver={MySQL ODBC 8.0 ANSI Driver}
224+
| ... odbc_driver={MySQL ODBC 9.2 ANSI Driver}
225225
| ... db_charset=latin1
226226
== Oracle via JDBC (jaydebeapi) ==
227227
| # Username and password must be set as a dictionary

test/resources/config_files/pyodbc/charset_invalid.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ user=db_user
55
password=pass
66
db_host=127.0.0.1
77
db_port=3306
8-
odbc_driver={MySQL ODBC 8.0 ANSI Driver}
8+
odbc_driver={MySQL ODBC 9.2 ANSI Driver}
99
db_charset=wrong

test/resources/config_files/pyodbc/custom_param_password.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ db_name=db
44
PWD=pass
55
db_host=127.0.0.1
66
db_port=3306
7-
odbc_driver={MySQL ODBC 8.0 ANSI Driver}
7+
odbc_driver={MySQL ODBC 9.2 ANSI Driver}

test/resources/config_files/pyodbc/invalid_custom_params.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ db_user=db_user
55
db_password=pass
66
db_host=127.0.0.1
77
db_port=3306
8-
odbc_driver={MySQL ODBC 8.0 ANSI Driver}
8+
odbc_driver={MySQL ODBC 9.2 ANSI Driver}
99
blah=blah

test/resources/config_files/pyodbc/old_param_names.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ dbUsername=db_user
55
dbPassword=pass
66
dbHost=127.0.0.1
77
dbPort=3306
8-
dbDriver={MySQL ODBC 8.0 ANSI Driver}
8+
dbDriver={MySQL ODBC 9.2 ANSI Driver}

test/resources/config_files/pyodbc/simple_default_alias.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ db_user=db_user
55
db_password=pass
66
db_host=127.0.0.1
77
db_port=3306
8-
odbc_driver={MySQL ODBC 8.0 ANSI Driver}
8+
odbc_driver={MySQL ODBC 9.2 ANSI Driver}

test/resources/config_files/pyodbc/valid_custom_params.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ UID=db_user
55
PWD=pass
66
db_host=127.0.0.1
77
db_port=3306
8-
odbc_driver={MySQL ODBC 8.0 ANSI Driver}
8+
odbc_driver={MySQL ODBC 9.2 ANSI Driver}

test/resources/config_files/pyodbc/wrong_password.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ db_user=db_user
55
db_password=wrong
66
db_host=127.0.0.1
77
db_port=3306
8-
odbc_driver={MySQL ODBC 8.0 ANSI Driver}
8+
odbc_driver={MySQL ODBC 9.2 ANSI Driver}

0 commit comments

Comments
 (0)