[Qt-interest] Can connect to to mysql server with Linux Qt app, but not with identical app on Windows
Jean Richard Lima
jean at jeanrl.com.br
Tue Oct 25 17:07:01 CEST 2011
Open the database like this:
if (!db.open()) {
QMessageBox::critical(0,"Error! ", "Unable to open the DataBase\n "+
db.lastError().text(), QMessageBox::Cancel);
return;
}
This way will give you the error message and will be easier to solve.
Jean Richard Lima
Consultor de Gestão e TIC
Software House de Projetos Específicos
2011/10/25 Robert Wood <robert.wood at apostrophe.co.uk>
>
> db = QSqlDatabase::addDatabase("**QMYSQL");
> db.setHostName("server");
> db.setUserName("robertw");
> db.setPassword("password");
>
> bool ok = db.open();
>
> bool is false. On Linux it is true and I can access the database.
>
> However, I have been trawling and found a way to get debug messages which
> tell me there is no mysql driver available, even though it [the program]
> compiles. I don't really understand this.
>
> I'm trying to follow some instructions of how to install the driver on
> Windows which seems to involve having to install mysql itself on Windows as
> well as installing the Qt driver (which apparently is a bit og a nightmare).
>
> Anyone who thinks Windows is easier to use than Linux has clearly never
> actually used Linux. ;~)
>
>
> On 25/10/11 14:17, Jean Richard Lima wrote:
>
>> What's the message of the error?
>>
>> Jean Richard Lima
>> Consultor de Gestão e TIC
>> Software House de Projetos Específicos
>>
>>
>> 2011/10/25 Robert Wood <robert.wood at apostrophe.co.uk
>> <mailto:robert.wood@**apostrophe.co.uk <robert.wood at apostrophe.co.uk>>>
>>
>>
>> Folks,
>>
>> I have written several apps on Linux to connect to a mysql server (the
>> server is also running Linux). I have been asked to write a program for
>> Windows that recalls data written to a database by a Linux machine.
>>
>> I am trying to connect to the database from a Qt app, but it is
>> refusing
>> access. If I boot into Linux (I have a dual boot laptop that I am
>> writing this software on), then I connect to the database from Qt and
>> the command line no problem (proving it's not an IP address rights
>> issue). Booting into Windows and running exactly the same app with Qt
>> from exactly the same place on the disk it refuses to connect.
>>
>> Is there something else I need to install on Windows that might be
>> installed as default on Linux to be able to access mysql databases? Do
>> I
>> maybe need to install mysql itself on Windows? I had assumed that
>> everything would be in Qt from the client perspective, but maybe that's
>> a false assumption!
>>
>> Many thanks.
>> ______________________________**_________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com <mailto:Qt-interest at qt.nokia.**com<Qt-interest at qt.nokia.com>
>> >
>> http://lists.qt.nokia.com/**mailman/listinfo/qt-interest<http://lists.qt.nokia.com/mailman/listinfo/qt-interest>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111025/344314d2/attachment.html
More information about the Qt-interest-old
mailing list