[Qt-interest] could not able to open mysqlsql database

Yuvaraj R yuvaraj at ongobiz.com
Wed Sep 30 21:01:33 CEST 2009


Sorry

English is  not my first language.. I didn't get u properly...

But database is valid only..
qDebug() << db.isValid();  //result true;

Some has replied posted like this

Q_IMPORT_PLUGIN(qsqlmysql)

and in your .pro file:

QTPLUGIN += qmysql .. is it correct.. i tried with one also

But i am getting
error:c:\Qt\2009.01\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
cannot find -lqmysql


Please help me

Thanks

Yuvaraj R

On Thu, Oct 1, 2009 at 12:17 AM, Mikhail Veygman <mveygman at gmail.com> wrote:

> Ok.
>
> Can you provide:
>
> db.isValid().  Also
>
> output of mysql -h localhost -u root -proot
> -
> Regards,
>
> Mikhail Veygman
>
>
> -----Original Message-----
> From: Yuvaraj R <yuvaraj at ongobiz.com>
> To: Mikhail Veygman <mveygman at gmail.com>
> Cc: qt-interest <qt-interest at trolltech.com>
> Subject: Re: [Qt-interest] could not able to open mysqlsql database
> Date: Thu, 1 Oct 2009 00:04:38 +0530
>
> Thanks for your reply
>
> Nothing i got from.
>
> qDebug() << db.lastError.text();
>
>
> Thanks
>
> Yuvaraj R
>
>
>
>
>
> On Wed, Sep 30, 2009 at 11:58 PM, Mikhail Veygman <mveygman at gmail.com>
> wrote:
>        Instead of the default SQLITE message.
>
>        Get:
>        db.lastError().text()
>
>        That may clear up some things.
>
>        -
>        Regards,
>
>        Mikhail Veygman
>
>
>
>        -----Original Message-----
>        From: Yuvaraj R <yuvaraj at ongobiz.com>
>        To: qt-interest <qt-interest at trolltech.com>
>        Subject: [Qt-interest] could not able to open mysqlsql database
>        Date: Wed, 30 Sep 2009 23:34:14 +0530
>
>        Hi All
>
>        I could not able to open  mysql  database..
>
>        please help me
>
>        my connection code is :
>
>        QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
>
>        db.setDatabaseName("Addu");
>
>        db.setHostName("localhost");
>
>        db.setUserName("root");
>
>        db.setPassword("root");
>
>        db.setPort(3306);
>
>        if (!db.open()) {
>
>        QMessageBox::critical(0, qApp->tr("Cannot open database"),
>
>        qApp->tr("Unable to establish a database connection.\n"
>
>        "This example needs SQLite support. Please read "
>
>        "the Qt SQL driver documentation for information how "
>
>        "to build it.\n\n"
>
>        "Click Cancel to exit."), QMessageBox::Cancel);
>
>        return false;
>
>        }
>
>        return true;
>
>        }
>
>
>        Please help me
>
>
>
>        I am struggling since last two days ..
>
>
>        Thanks
>
>
>        Yuvaraj R
>
>
>
>
>        _______________________________________________
>        Qt-interest mailing list
>        Qt-interest at trolltech.com
>        http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091001/d88554c5/attachment.html 


More information about the Qt-interest-old mailing list