Recent

Author Topic: Unable to Query the ODBC connection data in Free Pascal Lazarus IDE V3.4  (Read 244 times)

AnkitKastwal

  • Newbie
  • Posts: 1
I am currently trying to integrate the ODBC component within the Free Pascal Lazarus IDE version 3.4. While doing this the connection test is successful, but I encounter an error when executing queries. The error message states, "Error executing query: Transaction not set". I have tried to address this issue by creating a transaction component, but the problem persists. Additionally, I have encountered another issue that I have not yet been able to resolve, which is preventing the successful execution of queries

Could you please provide guidance on how to resolve this issue so that I can successfully query and preview data in the Free Pascal Lazarus IDE?

Please find the attached detailed steps that I have followed to achieve this

Zvoni

  • Hero Member
  • *****
  • Posts: 2718
Re: Unable to Query the ODBC connection data in Free Pascal Lazarus IDE V3.4
« Reply #1 on: September 13, 2024, 01:39:46 pm »
Read the correct "how-to".... https://wiki.freepascal.org/SQLdb_Package
Quote
    Make sure you have the relevant database client/driver installed.
    Go to the SQLdb tab in Component Palette.
    Add a TXXXConnection component (suitable for the type of database you are using) to a form, and fill in the appropriate properties to connect to your database. These will vary depending on the actual database. Make sure you can set the "connected" property to true.
    Add a TSQLTransaction component. Return to the Connection component, and set its Transaction Property to the new transaction. This should also set the transaction's database property. You should be able to set active to true.
    Add an SQLQuery component and set its Database property to the connecton component you just added.
    Set the SQLQuery "SQL" property. For a first test, just do a "select * from <tablename>".
    Set active to true. If this works, you have opened your query, and the data is available.
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Thaddy

  • Hero Member
  • *****
  • Posts: 15979
  • Censorship about opinions does not belong here.
Re: Unable to Query the ODBC connection data in Free Pascal Lazarus IDE V3.4
« Reply #2 on: September 13, 2024, 03:43:31 pm »
One further important thing to note that if you happen to compile for 64 bit, there are very very few 64 bit ODBC drivers and the only one that is reliable is the one for ms sqlserver. ODBC firmly lives in the land of 32 bit.
Oracle also has a 64 bit driver as part of ODAC, but I think that has a licensing issue. There is also one from CDATA it seems, but I am not familiar with that.
« Last Edit: September 13, 2024, 03:53:24 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

 

TinyPortal © 2005-2018