[Android-development] Unable to connect to MySQL
Muhammad Bashir Al-Noimi
mbnoimi at gmail.com
Sun Jul 9 15:35:42 CEST 2017
Hi,
Using this Gist
<https://gist.github.com/mbnoimi/e909ff3be27a6272b235efeef1cf8ec3#file-build_qt_mysql_driver-sh>
I could build MySQL plugin but unfortunately I unable to connect to any
MySQL server.
May you please help me to find out where is the problem?
I'm using:
* Qt 5.9.1
* Qt Creator 4.3.1
* Linux Mint 18.2 x64 xfce
* Android API - 19
Can't connect to MySQL server on '192.168.1.7' (107) QMYSQL: Unable to connect
MySQLClient.pro
QT += core gui sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = MySQLClient
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
CONFIG += mobility
MOBILITY =
DISTFILES += \
android/AndroidManifest.xml \
android/gradle/wrapper/gradle-wrapper.jar \
android/gradlew \
android/res/values/libs.xml \
android/build.gradle \
android/gradle/wrapper/gradle-wrapper.properties \
android/gradlew.bat
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
ANDROID_EXTRA_LIBS = \
/home/mbnoimi/Scripts/Shell/mysql_driver_qt/mariadb-connector-c-2.3.2-src/build/libmariadb/libmariadb.so \
$$PWD/../../../../.Qt/5.9.1/android_armv7/plugins/sqldrivers/libqsqlmysql.so
}
Connection snippet:
_db =QSqlDatabase::addDatabase("QMYSQL");
_db.setHostName("192.168.1.7");
_db.setPort("3306");
_db.setDatabaseName("db_account_76603915");
_db.setUserName("jassem");
_db.setPassword("123654789");
if (!_db.open()) {
ui->textEdit->append(_db.lastError().text());
}
IMPORTANT: I can connect to MySQL server through MySQL WorkBench using
same parameters without any problem.
--
Best Regards,
Muhammad Bashir Al-Noimi
Skype+Telegram+GMail: mbnoimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20170709/79636831/attachment.html>
More information about the Android-development
mailing list