You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Tuesday, May 17th 2005, 3:47pm

Qt 3.2.3 and database drivers... MYSQL3 driver not loaded

Hello

im new to qt, so please be patient with me.
im using Qt 3.2.3 that came with mand(rake/rive)linux 10. Im taking this database class which includes 20% for database project. So i decided to do it with Qt, but to my surprise there is no database drivers in qt3/plugins/sqldrivers

Later i found out free and non-commercial editions dont have sqldrivers.

Please guide me if its possible to get ( QODBC3, QOCI8, QPSQL7, QTDS7, QMYSQL3, QDB2 ) these drivers for non-commercial editions.

Appreciate any help

This post has been edited 3 times, last edit by "ultrabrite" (May 22nd 2005, 11:38am)


2

Tuesday, May 17th 2005, 3:59pm

RE: Qt 3.2.3 and database drivers

database drivers have to be installed separetely.

Search for something like "qt-MySQL-3.3.4-0.fc3.0.i386.rpm"

Cheers

This post has been edited 1 times, last edit by "Everall" (May 17th 2005, 4:01pm)


  • "wysota" is male

Posts: 4,276

Location: Warsaw, POLAND

  • Send private message

3

Tuesday, May 17th 2005, 4:04pm

RE: Qt 3.2.3 and database drivers

libqt3-mysql in Mandrake, to be precise.

4

Tuesday, May 17th 2005, 4:26pm

thx for quick reply, going school now... will try when i come back

5

Wednesday, May 18th 2005, 5:14am

ok i have install the package " libqt3-mysql" and now it show libqsqlmysql.so in
/usr/lib/qt3/plugins/sqldrivers

my question is, do i need to configure Qt to show QMYSQL3 ( correct me if wrong ) in the list of available drivers

thanks for help

AP.Sakkthivel

Professional

  • "AP.Sakkthivel" is male

Posts: 563

Location: India

Occupation: Application Development Using Qt

  • Send private message

6

Wednesday, May 18th 2005, 6:51am

check for .dll files in plugins\sqldrivers folder
If they are once available, then Qt will fetch it automatically.
No probs

-- cheers :)
Regards
- $akthi

You never know, how soon it may be too lateā€¦

7

Wednesday, May 18th 2005, 7:27am

if i understood correctly,

windows .dll is same as linux .so

and i do have ( after installation ) libqsqlmysql.so in /usr/lib/qt3/plugins/sqldrivers

so i should be okay and dont need to configure Qt

8

Wednesday, May 18th 2005, 7:34am

i'm using debian and after installing the wanted driver packages, all works fine. This should be the same for mandrake packages.
Use configure if you want to compile QT designer yourself. The packages have already done that for you.

mysql is only one of the drivers you mentioned in the first post. You can add the others in a similar way. Just look for the right rpm's.

Cheers

This post has been edited 3 times, last edit by "Everall" (May 18th 2005, 7:36am)


  • "wysota" is male

Posts: 4,276

Location: Warsaw, POLAND

  • Send private message

9

Wednesday, May 18th 2005, 7:39am

Quoted

Originally posted by ultrabrite
if i understood correctly,

windows .dll is same as linux .so

and i do have ( after installation ) libqsqlmysql.so in /usr/lib/qt3/plugins/sqldrivers

so i should be okay and dont need to configure Qt


It would be easiest if you just checked wheather the driver is in the list of drivers...

10

Wednesday, May 18th 2005, 7:48am

Quoted

Originally posted by wysota
It would be easiest if you just checked wheather the driver is in the list of drivers...

apolozise for stupid question, but could you explain where i need to go to check list of drivers

12

Wednesday, May 18th 2005, 7:55am

i found it, Qt designer, Project... database connections, New connection, QMYSQL3 shows up in driver combo box

i wanna thank you all & wysota for get me started with my project.

This post has been edited 1 times, last edit by "ultrabrite" (May 18th 2005, 8:03am)


13

Sunday, May 22nd 2005, 11:37am

i have looked into other similar threads and couldn't figure out the problem

this happens only with code written in Qt-Designer (ui.h) and doesn't happen with code written from scratch

below is what i get when i run app written in Qt-designer, im able to see MYSQL3 in project | database connections | new connection
QSqlDatabase: MYSQL3 driver not loaded
QSqlDatabase: available drivers: QMYSQL3

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void MainForm::init()
{
        QSqlDatabase *db = QSqlDatabase::addDatabase( "MYSQL3" );
        db->setDatabaseName( "test" );
	db->setUserName( "sqldemo" );
	db->setPassword( "eagle" );
	db->setHostName( "192.168.1.4" );
	db->setPort( 3306 );
	
	if ( !db->open() )
	{
               // flag error message
	}
    }
}


But the same code written from scratch connects to database

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <qapplication.h>
#include <qsqldatabase.h>
#include <qsqlcursor.h>

int main( int argc, char *argv[] )
{
  QApplication app( argc, argv );

  QSqlDatabase *db = QSqlDatabase::addDatabase( "QMYSQL3" );
  db->setDatabaseName( "test" );
  db->setUserName( "sqldemo" );
  db->setPassword( "eagle" );
  db->setHostName( "192.168.1.4" );
  db->setPort( 3306 );

  if ( !db->open() )
    {
      qWarning( "Failed to open database: " + db->lastError().driverText() );
      qWarning( db->lastError().databaseText() );
       return 1;
     }
  return 0;
}


do i need to make any chages in Qt-designer
please advise how i can solve this.
appreciate your help

jacek

Master

  • "jacek" is male

Posts: 2,729

Location: Warsaw, Poland

  • Send private message

14

Sunday, May 22nd 2005, 3:43pm

Quoted

Originally posted by ultrabrite
QSqlDatabase: MYSQL3 driver not loaded
QSqlDatabase: available drivers: QMYSQL3

Do you see the difference?

15

Sunday, May 22nd 2005, 4:25pm

omg, i spend so much time figuring out, stupid spelling mistake X(

thankyou for pointing out, it works now