Recent

Author Topic: Problem with SQLdb  (Read 10057 times)

pholta

  • New member
  • *
  • Posts: 7
    • http://pholta.wz.cz
Problem with SQLdb
« on: February 12, 2006, 10:07:43 pm »
Hi,

I am using SQLdb component to connect my application to MySQL db(4.0.0-alpha, WinXp, Lazarus version 0.9.12). The database seems to be OK, but I have problems opening any query in design-time. MySQLConnection connects just fine, but when I open any query (select * from db), I got "db" is an invalid integer...

Any ideas?

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: Problem with SQLdb
« Reply #1 on: February 13, 2006, 05:46:14 pm »
Do you have a transaction defined as well?
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

pholta

  • New member
  • *
  • Posts: 7
    • http://pholta.wz.cz
RE: Problem with SQLdb
« Reply #2 on: February 13, 2006, 10:15:30 pm »
Yes, I do, there are 3 components on the form:
MySQLConnection - DatabaseName, HostName, UserName Transaction = SQLTransaction  and Password are set and when I set Connected to true, it seems to work
SQLTransaction - Database = MySQLConnection (when I try to make it active, it turns back to false :((()
SQLQuery - Transaction = SQLTransaction, Query = select * from db

Where could be the problem?

I tried downloading some examples, but nothing did work:(

Anonymous

  • Guest
RE: Problem with SQLdb
« Reply #3 on: February 14, 2006, 06:34:17 pm »
Hi, is db the name of one of your tables or the database name? In case it is the name of your database, you need to provide a table name in your query instead of db.

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: Problem with SQLdb
« Reply #4 on: February 14, 2006, 06:55:33 pm »
Is there a datetimefield in your table?
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

pholta

  • New member
  • *
  • Posts: 7
    • http://pholta.wz.cz
RE: Problem with SQLdb
« Reply #5 on: February 14, 2006, 11:55:14 pm »
Guest: db is the name of the table in MySQL scheme on the server, this should be OK :)

matthijs: no, there are just char and enum fields :( could there be any problem with the transaction (that i can not set it active) ?, maybe I will try firebird datadase if it works better....

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: Problem with SQLdb
« Reply #6 on: February 15, 2006, 08:32:04 am »
I've seen both (MySQL and Firebird) working correctly with Lazarus. Problem with MySQL is you need to use the component made for the version of mysql client library installed on the computer. It looks somehow you have a mistake somewhere. Could you make (and post) a small sample program in which the error occurs? If you supply the database schema as well (or use mysql db from mysql), we can try it ourself and see what goes wrong.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

pholta

  • New member
  • *
  • Posts: 7
    • http://pholta.wz.cz
RE: Problem with SQLdb
« Reply #7 on: February 15, 2006, 10:42:52 am »
I understand that the compatibilityof the SQLbd and MySQL might be tricky, could you recomend me some version of MySQL that works with the latest stable offcial release of Lazarus (0.9.12). of course I use the the libmySQL.dll distributed with MySQL.

Another question, is it better to use
mysql\lib\opt\libmySQL.dll or
mysql\lib\debug\libmySQL.dll?

Unfortunately, I am not at my computer right now, but I will try to send a sample project, so that you can see where is the problem.

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: Problem with SQLdb
« Reply #8 on: February 15, 2006, 02:43:38 pm »
Lazarus 0.9.12 works with MySQL 4.0, MySQL 4.1 and MySQL5.0. That means as long as you use the proper MySQLConnection fit for the available client library.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

pholta

  • New member
  • *
  • Posts: 7
    • http://pholta.wz.cz
RE: Problem with SQLdb
« Reply #9 on: February 15, 2006, 02:53:58 pm »
it is strange, because when I tried to use MySQL5.0, I got error that this version was not supported:(

pholta

  • New member
  • *
  • Posts: 7
    • http://pholta.wz.cz
RE: Problem with SQLdb
« Reply #10 on: February 15, 2006, 10:47:30 pm »
Hi everybody, I tried to compile my program and it worked, so it seems that the problem is only in design-time. I made a small sample application, it can found here:

http://pholta.wz.cz/MySQL.zip

The archive contains a sql script for creating a new scheme, the table and it inserts some rows in it. The connection informations are hard-coded, so if you want to try it yourself, you will have to change the userName and the Password:)

pholta

  • New member
  • *
  • Posts: 7
    • http://pholta.wz.cz
RE: Problem with SQLdb
« Reply #11 on: February 19, 2006, 11:56:42 am »
Thanks guys for your help, I am glad to see that this forum and Lazarus works and there lots of contributors here:)

I am going to do one more test using Firebird and than I will choose either MySQL or Firebird to implement a small IS using Lazarus.

 

TinyPortal © 2005-2018