[PyKDE] Trouble with sql examples from Qt 3.x.

Denis Bitouzé dbitouze at wanadoo.fr
Thu May 27 12:11:01 BST 2004


Hello,

I read carefully the README file in PyQt-3.8/examples3/SQL/ and I
suppose that all the required packages are installed:

[bitouze at drums SQL]$ rpm -qa | grep sql
postgresql-contrib-7.4.1-2mdk
postgresql-pl-7.4.1-2mdk
php-pgsql-4.3.4-1mdk
postgresql-tcl-7.4.1-2mdk
libsqlguipgsql0-0.1.1-3mdk
libsqlguipart0-0.5.1-2mdk
libsqlguipart0-devel-0.5.1-2mdk
postgresql-7.4.1-2mdk
postgresql-test-7.4.1-2mdk
postgresql-devel-7.4.1-2mdk
postgresql-docs-7.4.1-2mdk
libsqlguipgsql0-devel-0.1.1-3mdk
mysqlcc-0.9.4-1mdk
libqt3-mysql-3.2.3-19.2.100mdk
perl-Mysql-1.22_19-9mdk
postgresql-server-7.4.1-2mdk
libmysql12-4.0.18-1.1.100mdk
libqt3-psql-3.2.3-19.2.100mdk
sqlgui-0.5.1-4mdk
[bitouze at drums SQL]$

I created testdb database for user 'bitouze' who is a
postgresql super-user and is allowed to create databases:

[bitouze at drums SQL]$ psql -U bitouze template1 -f testdb_pg.sql
CREATE DATABASE
Vous êtes maintenant connecté à la base de données «testdb» en tant
qu'utilisateur «postgres». psql:testdb_pg.sql:23: NOTICE:  CREATE TABLE
/ PRIMARY KEY will create implicit index "people_pkey" for table
"people" CREATE TABLE
psql:testdb_pg.sql:38: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "staff_pkey" for table "staff" CREATE TABLE
psql:testdb_pg.sql:50: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "status_pkey" for table "status" CREATE TABLE
psql:testdb_pg.sql:64: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "creditors_pkey" for table "creditors" CREATE TABLE
psql:testdb_pg.sql:77: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "prices_pkey" for table "prices" CREATE TABLE
psql:testdb_pg.sql:91: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "invoiceitem_pkey" for table "invoiceitem" CREATE TABLE
CREATE SEQUENCE
CREATE SEQUENCE
CREATE SEQUENCE
CREATE SEQUENCE
psql:testdb_pg.sql:141: ERROR:  invalid input syntax for type money:
"$123,450.50" CONTEXT:  COPY staff, line 1, column salary:
"$123,450.50" setval
--------
      1
(1 ligne)

 setval
--------
      8
(1 ligne)

 setval
--------
      1
(1 ligne)

 setval
--------
      1
(1 ligne)
[bitouze at drums SQL]$

I suppose that Qt was build with the psql module activated (I don't
know how to check this point):

[bitouze at drums SQL]$ rpm -qa | grep qt
qt3-example-3.2.3-19.2.100mdk
pqt-designer-1.00-2mdk
qt3-common-3.2.3-19.2.100mdk
libqtc1-3.2-1mdk
libqt3-devel-3.2.3-19.2.100mdk
libqt3-mysql-3.2.3-19.2.100mdk
libqt3-psql-3.2.3-19.2.100mdk
libqt3-3.2.3-19.2.100mdk
[bitouze at drums SQL]$

But, though I can open testdb database:

[bitouze at drums SQL]$ psql testdb
Bienvenue dans psql 7.4.1, l'interface interactive de PostgreSQL.

Tapez:  \copyright pour les termes de distribution
        \h pour l'aide-mémoire sur les commandes SQL
        \? pour l'aide-mémoire sur les commandes internes
        \g ou terminez avec un point-virgule pour exécuter une requête
        \q pour quitter

testdb=#

when I try:

python dbconnect.py

I get the following error message when cliking on 'OK':

Cannot open testdb database on localhost!

QMYSQL3: Unable to connect
Unknown database 'testdb'

Thanks in advance for any help!

Greetings,
-- 
Denis.




More information about the PyQt mailing list