Problems connecting to Firebird #2 lazarus / 16-Databases ---------------------------------------------------------------------- emaza · 2008-03-20 04:09 Hi. I really need help. I am new to Firebird and Lazarus (and to RADtools, OOP and to “real mission-critical, not toy-desktop-databases”, etc). To teach myself before starting a real project –not an easy task- I tried building a simple one-form program, to build and edit a list of accounts using my Windows XPpro laptop as both sever and client. I installed the Superserver version 2.0.3 as a service, and (I think) the FBCLIENT.dll and not the GDS32.dll, since I understood this to be the preferable choice, for those with no “legacy” issues. I Used Firebird’s ISQL tool to build a database (Test.fb, not “.fdb” because it was what the TIBConnection seemed to like when searching for a database to link) with two tables. Table1 with Two columns: Acct_No and Acct_Descrip; and a Table2 with an additional column using Firebird’s Generator feature to create an “autonumeric” ID column. This in case it was needed by Lazarus’ Navigator buttons. From the SQLdb tab I dropped boxes on the form: TIBConnection, TSQLQueery and TSQLTransaction. Wrote a “SELECT * FROM.. (table)” command on the TSQLQueery. Connected everything and also dropped a TDBGrid, a TDBNavigator and a TDBEdit, this last to leave the grid as read-only. Everything works fine as far as moving the pointer, editing, inserting, and deleting rows in the DataSet of either table, as displayed by the grid, but changing any data inside either of the two tables is, however, impossible. I have spent weeks reading everything I could find in the Firebird’s and Lazarus’s documentations, wikis, and everything I could Google. It helped to get me this far, but no further. I have tried everything I could think of, and/or copy, from the little information available, and have only produced errors or access violations. I am ready to give up. This is a last resort request. If someone out there could point me to a reference, example, white-paper, web-page, book, or any resource that could help me with this, it would be great. Do not want to go back to Dbase tables, and last century’s DOS Foxbase programming. Help!   :roll:  :evil:  :? ---------------------------------------------------------------------- tatamata · 2008-03-20 10:12 Hello. Have you checked Read-only property of datasets and controls? I use Zeoslib with Firebird 2.0.3 and works perfectly well, so I would suggest you to give it a try. As you are a beginner, the benefit with Zeoslib is that it behaves very much like BDE in Delphi, so you can use any Delphi book regarding databases as well as Firebird documentation to learn about it. That's how I started. ---------------------------------------------------------------------- emaza · 2008-03-25 21:38 Hi! Many thanks for replying. I was out for Easter. Yes, I have tried setting ReadOnly to False on all components, including the TDBGrid with no results. I have also tried writing SQL commands in the DeleteSQL, InsertSQL and UpdateSQL properties of the SQLQuery box, but only the string in the SQL property of the SQLQuery seems to work. (The SQLQuery box/component is from the SQLdb tab) Following your advise I went to Zeos page –too many download options! I downloaded release candidate version: ZEOSDBO-6.6.2-rc, since the last labeled “stable version” I could find seemed too old, 2004 I believe, and was unsure of what the MD5 and SHA versions meant. Created an “installed_components” file inside the C:\lazarus\components folder and emptied the zip there. With Lazarus, I compiled the zcore, zparses, zplain, and zdbc Lazarus packages and installed the zcomponent package. The Zeos Access tab is now in my Lazarus editor with, I believe, all the needed access components, BUT, I get a “Requested database driver was not found” error when I try to set to “True” the Active property of  the TZQuery dropped in my form. Searched the web for this error but found little help. Did I download the wrong Zeoslib version, or is it something else? ---------------------------------------------------------------------- tatamata · 2008-03-26 07:51 Hi. You don't need SelectSQL, InsertSQL or UpdateSQL for regular SQL query. You only need regular TZQuery component for read-only queries with it's SQL property. Those additional properties are only used with so-called updateable queries, which is an extension to normal query behavior. Bare in mind that normal select queries are normally always read-only if based on more than one table (joins), even if you set REad-only property to false. It can be updatable only if the query is based on only one table. The purpose of queries are to retrieve results, not to provide updateable dataset. You can make queries consisted of several tables updatable too, by combining ZQuery and ZUpdateSQL components (see Firebird documentation regarding Delphi), but before you do it, ask yourself do you really need updateable query? It is most likely that for data input regular ZTable component is enough. Contrary to ZQuery which is read-only by defaulr, especially if query is based on more than one table, ZTable is updatable by default. Use ZTable for data input and update. Use ZQuery for reporting of results. Use combination of ZQuery and ZUpdateSQL components only in special situations, when normally read-only SQL query must be updateable. Read Firebird documentation and Zeos documentation to see how to do it. It is not easy, I warn you. Regarding database driver, I suppose it is due Path environmental variable. I suppose that the path to Firebird client libraries is not set on your system. So, you have two options: either set the path to Firebird client libraries in the Path environmental variable, either download Firebird embedded and extract DLLs into your project directory. Rename fbembed.dll to fbclient.dll or gds32.dll (I am not sure, but think that Zeos prefers gds32.dll). Then check the following ZConnection properties: Database - full path to your database Password - masterkey Port -3050 Protocol - firebird-2.0 TransactionIsolationLevel - tiReadCommitted User -SYSDBA DesignConnection -true AutoCommit -true Connected -true Host -localhost Regards, Zlatko ---------------------------------------------------------------------- emaza · 2008-03-30 23:18 Hi Followed your instructions and fixed Zeos problem. It is embarrassing to admit, but might help others to know error was because protocol property on ZConnection was empty. Setting it to firebird 2.0 fixed everything. Did not have to switch fbclient.dll to gs32.dll Many many many many thanks Zlatko. I can now make changes to a table, experiment and learn how to best use Z components following your advice on ZQueries and Ztable components. ---------------------------------------------------------------------- tatamata · 2008-03-31 09:00 I'm glad you did it! Keep on going:) Zlatko