Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soci+mariadbclient 3.3.8-1 failed to connect to a mysql database, while it works with 3.1.13(replace the libmariadb.dll with old one works) #19861

Closed
2 of 7 tasks
asmwarrior opened this issue Jan 25, 2024 · 10 comments · Fixed by #19878
Labels

Comments

@asmwarrior
Copy link

Description / Steps to reproduce the issue

I have c++ code to connect to mysql through the mariadbclient library , it used to work with the mariadbclient version 3.1.3, but after I upgraded yesterday, I see it can't connect to the mysql now.

I just replace the libmariadb.dll file with the old libmariadb.dll(version 3.1.13), my code works, so I believe the interface may changes?

This is the test code:

#include <soci/soci.h>
#include <soci/mysql/soci-mysql.h>

int main()
{
    soci::session sql(soci::mysql, "dbname=testdb user=root password=123456");
    return 0;
}

Note I also use the soci library, it looks like the libmariadb library has some interface changes, so soci library just failed to use it.

The above program will report some error like:

terminate called after throwing an instance of 'soci::mysql_soci_error'
  what():  Plugin caching_sha2_password could not be loaded: 找不到指定的模块。 Library path is 'caching_sha2_password.dll'

The text "找不到指定的模块。" means it can't find the specified module.

Expected behavior

It should connect to the mysql correctly

Actual behavior

failed to connect to the mysql database

Verification

Windows Version

MINGW64_NT-10.0-19045

MINGW environments affected

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANG32
  • CLANGARM64

Are you willing to submit a PR?

No response

@Biswa96
Copy link
Member

Biswa96 commented Jan 25, 2024

Could you provide steps to compile the program?

@asmwarrior
Copy link
Author

Could you provide steps to compile the program?

OK, since I'm using Code::Blocks IDE, here is the build log:

[ 50.0%] g++.exe -Wall -fexceptions -g -IF:\msys2\mingw64\include\mysql -c D:\project\main.cpp -o obj\Debug\main.o
[100.0%] g++.exe  -o bin\Debug\test.exe obj\Debug\main.o  -lsoci_core_4_0 -lsoci_mysql_4_0  
Output file is bin\Debug\test.exe with size 483.75 KB

Thanks.

@raedrizqie
Copy link
Contributor

i think this can fix the mysql error:
mariadb-corporation/mariadb-connector-c#234

@Biswa96
Copy link
Member

Biswa96 commented Jan 26, 2024

In my case, the program shows the following error.

terminate called after throwing an instance of 'soci::mysql_soci_error'
  what():  Can't connect to server on 'localhost' (10061)

I think there is some info missing about reproducing the error in original post.

@asmwarrior
Copy link
Author

In my case, the program shows the following error.

terminate called after throwing an instance of 'soci::mysql_soci_error'
  what():  Can't connect to server on 'localhost' (10061)

I think there is some info missing about reproducing the error in original post.

What extra information should I post? I'm running MySQL 8.0.33 in Win10 64bit, and the export TCP port is 3306(default).

@Biswa96
Copy link
Member

Biswa96 commented Jan 27, 2024

Thanks for the info. I can reproduce the issue and get the same error message in original post. From a quick look, the issue is about path relocation.

@Biswa96
Copy link
Member

Biswa96 commented Jan 27, 2024

I have added a pull request to fix this issue. Would you like to test the packages from GitHub Actions artifacts of that pull request?

I got the following error with the fix. I guess this error is expected because I am not running any db, right?

terminate called after throwing an instance of 'soci::mysql_soci_error'
  what():  Unknown database 'testdb'

@asmwarrior
Copy link
Author

I have added a pull request to fix this issue. Would you like to test the packages from GitHub Actions artifacts of that pull request?

I got the following error with the fix. I guess this error is expected because I am not running any db, right?

terminate called after throwing an instance of 'soci::mysql_soci_error'
  what():  Unknown database 'testdb'

OK, I can test it. Can you show me the package file, so that I can install that package locally in my PC.

@Biswa96
Copy link
Member

Biswa96 commented Jan 27, 2024

Please follow these steps for testing package in CI artifacts.

  1. Go to this page https://github.com/msys2/MINGW-packages/actions/runs/7677849506 > scroll down > download the XYZ-packages.zip file. The XYZ should match with the value of $MSYSTEM variable.
  2. Extract the .tar.zst file from that ZIP.
  3. Install the .tar.zst file with pacman -U <full path of .tar.zst file> command.

@asmwarrior
Copy link
Author

Please follow these steps for testing package in CI artifacts.

1. Go to this page https://github.com/msys2/MINGW-packages/actions/runs/7677849506 > scroll down > download the XYZ-packages.zip file. The XYZ should match with the value of `$MSYSTEM` variable.

2. Extract the .tar.zst file from that ZIP.

3. Install the .tar.zst file with `pacman -U <full path of .tar.zst file>` command.

Thanks, I just tested this new package, and it solves my reported issue. Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants