Accessing xampp mysql database
Hi folks,
here is what I want to do:
I'running an apache mysql server with xampp on a windows vista 32bit machine (would like to do this with linux, but have to do it with vista...) and want to access a database through the QSqlTableModel in my xampp/mysql directory.
The dev packs(lib and header) for mysql is installed.
Qt Version is 4.4.3 and i tried to install the mysql plugin with the following command in the Qt command prompt: "c:\Qt\4.4.3\src\plugins\sqldrivers\mysql>qmak e "INCLUDEPATH+=C:\xampp\MySQL\incl
ude" "LIBS+=C:\xampp\MySQL\lib\opt\libmysql.lib" mysql.pro"
This command works, but when i do a "make" afterwards, i get lots of errors with 'undefined references to 'mysql_query@8'' and exit status 1.
Helpful:
http://doc.trolltech.com/4.4/sql-dri...gin-on-windows and
http://wiki.qtcentre.org/index.php?t...ws_using_MinGW
Installing latest mingw and using reimp should work.
What did i do wrong?
Does the mysql server has to be running when installing? - i guess no -
Is the process for installing the mysql plugin similiar for Qt4.5?
Do I need to have the mysql running as a service in my xampp control center, when I want to access the database?
Has anybody experience with this issue?
Any help would be a peach
Best Regards
--synack
Re: Accessing xampp mysql database
Hi,
in context to this article
http://wiki.qtcentre.org/index.php?t...ws_using_MinGW
I need a little bit help please.
The scenario is the mentioned above. I did steps 1-4 how described in the wiki article and no errors.
At step 5 when doing 'make', I get these errors:
<pre>
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1676: error:
declaration of C function `LONG InterlockedIncrement(volatile LONG*)' conflicts
with
../../../../include/QtCore/../../src/corelib/arch/qatomic_windows.h:388: error:
previous declaration `long int InterlockedIncrement(long int*)' here
mingw32-make[1]: *** [tmp/obj/release_shared/main.o] Error 1
mingw32-make[1]: Leaving directory `c:/Qt/4.4.3/src/plugins/sqldrivers/mysql'
mingw32-make: *** [release-all] Error 2
</pre>
I really have no glue that i'm doing wrong.
MinGW works, the lib and header for mysql is installed, reimp works, liblibmysql.a has been created, so if you have any suggestions post them.
Regards
--synlag
Re: Accessing xampp mysql database
Perhaps this an issue for the bug tracker.
Here's that really simple code, i want to run:
Code:
#include <QtGui>
#include <QtSql>
#include <QtDebug>
int main(int argc, char *argv[])
{
db.setHostName("localhost");
db.setDatabaseName("c5testdb");
db.setUserName("root");
db.setPassword("");
if(!db.open()) {
return 1;
}
model.setTable("users");
model.select();
tableView.setModel(&model);
tableView.setWindowTitle("SQL-Demonstration");
tableView.show();
return a.exec();
}
;)
Re: Accessing xampp mysql database
create QSqlTableModel model; on a heap.
Re: Accessing xampp mysql database
Quote:
Originally Posted by
spirit
create QSqlTableModel model; on a heap.
:confused:
Did you read the two posts above? I think no you didn't.
For this example it makes no difference if the model is on heap or stack.
Re: Accessing xampp mysql database
Does anyone has experience setting up a mysql connection with Qt4.5 ?
Re: Accessing xampp mysql database
Re: Accessing xampp mysql database
Ok, it would be nice if you could explain what is the difference between installing mysql on a windows machine to the previous Qt version, if there is any.
I did it like described in this article
http://wiki.qtcentre.org/index.php?t...ws_using_MinGW
but it does not work for Qt4.5
Thx so far
Re: Accessing xampp mysql database
wimblows, so i'm back on my lamp now...
works fine so far, and when i've time i'll maybe look into it, making the app work for win