Interbase 2009 lazarus / 16-Databases ---------------------------------------------------------------------- lindaandjon · 2016-06-23 17:50 Could someone confirm that Interbase 2009 SMP will or won't work with Lazarus 1.6 please?  I've read some documentation saying Lazarus is only compatible with 5/6 which I'm hoping is out of date? if so, is there a guide to how to connect Lazarus to my Interbase databases anywhere please? Many thanks ---------------------------------------------------------------------- Graeme · 2016-06-23 22:55 Lazarus doesn't include any Database specific connection components. They all come from the Free Pascal Compiler project. I'm fairly confident that using the SqlDB components will work with Interbase 2009 too. The units in question will be:   sqldb   IBConnection The components in those units will be:   TIBConnection   TSQLTransaction   TSQLQuery The Free Pascal Wiki has some pages on using SqlDB database components. The database units are also document by FPC (see the fcl.pdf) ---------------------------------------------------------------------- LacaK · 2016-06-24 06:00 I think, that it will work. I have ran (some time ago) db test suite against Interbase XP and it worked But this are all my experiences ... ---------------------------------------------------------------------- lindaandjon · 2016-06-25 09:06 Thanks, I can't figure out how to set up Lazarus to see the actual database though.  I've got a fully working database, and Lazarus with the IBConnection component but can't get it to connect to the database.  Do I need various Interbase .dll's rather than firebord ones?  As its a local machine do I leave Hostname blank?  And what is the format for pointing to the database on the component - does the select file dialog set it up correctly.  In my early Delphi days this had to be set up manually not using the dialog box for some reason and its that long ago I can't remember why - old age for you!  Thanks ---------------------------------------------------------------------- Graeme · 2016-06-25 09:56 Connecting to Interbase is the same as to Firebird as far as I know, but then I haven't used Interbase since Delphi 7 days. The connection string format is as follows: Remote servers:   :   : Local server:     Some components can figure out from the connection string if it is a local or remote database. For other connection components you need to set a property like "Local = true" or something. ---------------------------------------------------------------------- rvk · 2016-06-25 10:05 Quote from: lindaandjon on June 25, 2016, 11:06:02 amI've got a fully working database, and Lazarus with the IBConnection component but can't get it to connect to the database.  Do I need various Interbase .dll's rather than firebord ones?If you have a working Interbase server running on that machine, you don't need any firebird dll's. Actually you don't need any dll's in your application directory. If you have... remove them all. Interbase server should have installed a gds32.dll in the searchpath which will be used automatically. (Note: but you DO need the Interbase server installed on your machine). Check if you have gds32.dll in C:\Windows\system32 and C:\Windows\SysWOW64. QuoteAs its a local machine do I leave Hostname blank?I'm not sure if connecting without hostname will work on Interbase. On (older) Firebird servers it worked and would create a local connection but with the last version this doesn't work anymore (I think). So always supply a hostname (unless you are using an embedded version, which you are not). You can use 127.0.0.1 or localhost as hostname. Fill in SYSDBA for username and masterkey as password (if that's how the Interbase server is set up) and the full-filename for databasename. After that it should work. What error are you getting when you are trying to connect?? ---------------------------------------------------------------------- lindaandjon · 2016-06-26 08:28 Thanks for all the replies. My server is running and I've checked that I have gds32.dll in the places mentioned and also not in my project folder.  The database opens fine with my IbConsole and I can browse the data, restructure etc. I've tried localhost and 127.0.0.1 and I get the following error with either setting IBConnection1: DoInternalConnect -Unable to complete network request to host "localhost" -Failed to establish network connection I'm running Windows 10 and using Delphi 7 I can connect to the database fine.  I'd just like to use Lazarus instead of my ancient D7!  I've also tried turning my firewall off too. Many thanks for any help. Jon ---------------------------------------------------------------------- rvk · 2016-06-27 10:35 What are you using as host to connect in Delphi 7? You could try to leave hostname empty. Also check if you don't have fbembed.dll and fbclient.dll anywhere in your searchpath. If FPC encounters one of those it won't use gds32.dll (which is needed for Interbase). ---------------------------------------------------------------------- lindaandjon · 2016-06-27 16:22 Thanks. I'm using a TIBDatabase component with the full name and path of the database listed in DatabaseName.  It works fine here. I've tracked down an Fbclient.dll in the system32  directory and removed it and now I get an error saying Can not load default Firebird clients (fbclient or gds32.dll or fbembed.dll) Check your installation. I presume Firebird can't find the gds32.dll but I've tried putting it in system32 and it still gets the same error. Any more ideas please? ---------------------------------------------------------------------- rvk · 2016-06-27 16:28 Quote from: lindaandjon on June 27, 2016, 06:22:46 pmI've tracked down an Fbclient.dll in the system32  directory and removed itBINGO. That was the problem. Quoteand now I get an error saying. Can not load default Firebird clients (fbclient or gds32.dll or fbembed.dll) Check your installation. I presume Firebird can't find the gds32.dll but I've tried putting it in system32 and it still gets the same error. Be very careful putting just a gds32.dll in the system32 directory. The system32 directory is for 64Bit dlls on a 64bit system. If you have 32bit Lazarus and a 32bit gds32.dll you need to put it in C:\Windows\SysWOW64 (confusing he ). So: On 64bit Windows: 32bit Lazarus, put the 32bit gds32.dll in C:\Windows\SysWOW64 64bit Lazarus, put the 64bit gds32.dll in C:\Windows\system32 On 32bit Windows: 32bit Lazarus, put the 32bit gds32.dll in C:\Windows\system32 If you reinstall Interbase 2009 it should give you an option (on the last page) to copy a gds32.dll to the correct system-directories (at least, that's the case with Firebird, except the last one which requires also manual copying of gds32.dll). Put when copying manually make sure to put the correct bitness (32/64) dll in the correct Windows directory. ---------------------------------------------------------------------- lindaandjon · 2016-06-27 17:42 Sounds like we're getting there! I'm running Windows 10 64bit, Lazarus 1.6 64bit and Interbase 2009SMP which I believe is 32 bit??. Interbase doesn't copy the Gds32.dll so I've copied from Interbase/bin to system32 after reinstalling Interbase and deleting all existing copies of gds32.dll. Sadly I still get the same error.  Your guide didn't include Lazarus 64 windows 64 and Interbase 32, I assume this is the problem?  Is there a way around it possibly? ---------------------------------------------------------------------- rvk · 2016-06-27 17:53 Quote from: lindaandjon on June 27, 2016, 07:42:09 pmI'm running Windows 10 64bit, Lazarus 1.6 64bit and Interbase 2009SMP which I believe is 32 bit??. Interbase doesn't copy the Gds32.dll so I've copied from Interbase/bin to system32 after reinstalling Interbase and deleting all existing copies of gds32.dll. Your guide didn't include Lazarus 64 windows 64 and Interbase 32, I assume this is the problem?  Is there a way around it possibly? My guide didn't include Laz64 on Win64 and Interbase 32bit because you need the 64bit dlls for Laz64. If you copied gds32.dll 32bit into C:\Windows\system32 you need to remove it from there because that was a 32bit version of gds32.dll (wasn't it?). You can copy it to C:\Windows\SysWOW64 but Lazarus 64bit won't do anything with that because it really needs the 64bit version of gds32.dll. If you can't find any 64bit drivers (gds32.dll) for Interbase 2009, you could try installing the client of InterBase XE7 64bit (make sure you choose client install and not server). Or you could use Lazarus 32bit (in which case the 32bit gds32.dll from C:\Windows\SysWOW64 will be taken). ---------------------------------------------------------------------- lindaandjon · 2016-06-27 19:34 Thanks again!  I've tried the Interbase 64bit gds32.dll in the system32 and I still get the error. I've moved it to wow64 (which is where XE installed it to) and same error too.  With Interbase uninstalled you get the same error (unsurprisingly) but the speed you get the error with or without interbase installed is identical.  Does Lazarus need to be told where to look for the dll? Maybe I should just move over to Firebird! ---------------------------------------------------------------------- rvk · 2016-06-27 19:43 Quote from: lindaandjon on June 27, 2016, 09:34:38 pmI've tried the Interbase 64bit gds32.dll in the system32 and I still get the error. I've moved it to wow64 (which is where XE installed it to) and same error too.If Interbase XE 64bit installed a gds32.dll to SysWOW64, it is the 32bit version. You shouldn't take that one. It should have installed another 64bit version in system32. Otherwise you could take the gds32.dll from the Interbase directory C:\Program Files\Interbase (not Program Files (x86) !!!). If Interbase installed itself to Program Files (x86) it's not the 64bit version. (Never ever move DLLs from system32 to SysWOW64 and visa versa because system32 has 64bit versions and SysWOW64 has 32bit versions and they are not interchangeable... period) Quote from: lindaandjon on June 27, 2016, 09:34:38 pmDoes Lazarus need to be told where to look for the dll?No, not if the gds32.dll is in the searchpath (which C:\Windows\system32 is). QuoteMaybe I should just move over to Firebird! Yes. You could still try Interbase XE server or higher (which has a 64bit version). But I don't think it is free. And I'm not sure if you can upgrade from Interbase 2009. If you're not stuck with Interbase for some reason, going to Firebird 2.5 server 64bit would be simplest solution. So it's either Lazarus 32 bit with Interbase 2009 or Lazarus 64 bit with Firebird 2.5 64bit (or 3.0) or Lazarus 64 bit with Interbase XE+ 64bit. I'm also not sure why you would want a 32bit Interbase version but need to have Lazarus 64bit. In that case Lazarus 32bit would do just fine. And if you definitely want 64bit Lazarus (for some reason) you should also want a 64bit DB-engine. ---------------------------------------------------------------------- lindaandjon · 2016-06-27 20:21 I stand suitably slapped for the moving dll's - lol. In answer to your questions I'm familiar with Interbase and haven't really programmed since 2009, so it was just the database I had on hand that I know.  I had just downloaded Lazarus as its Delphi like (which I also am familiar with and D7 doesn't work properly on W10) but hadn't really clicked about the 64 and 32 bit stuff.  I never did anything in 64bit I'm so old and the brain's a bit rusty! I'll have a play around now with all your suggestions. Again, many thanks for taking the time to try to help me get this sorted, that's very kind of you and I really do appreciate it. ---------------------------------------------------------------------- rvk · 2016-06-27 20:34 In that case I would defenitly install Firebird 2.5 server 64bit. Until version 1.6, Lazarus always installed the 32bit version of itself, even on 64bit systems. It was the preferred version. From 1.6 onward this changed and now the 64bit is default on 64bit version of Windows. You're not the only one hitting this problem of mixing 32/64bit and it indeed takes some effort to make sure you've got the right DLL versions. For Lazarus it shouldn't really matter if you use 32 or 64 bit if you're just programming normally in Pascal. So I would say, go for the default Lazarus 64bit and install Firebird 2.5 64bit. That should work fine. If you need other DLLs in the future, like OpenSSL or similar, you now know to get the 64bit versions. Single DLLs can also be put in the program directory (of your .exe) and when debugging in the IDE in the C:\Lazarus directory, or can be put into C:\Windows\system32 if you need them to be systemwide (i.e. also other programs). Happy programming. ---------------------------------------------------------------------- lindaandjon · 2016-06-28 07:18 Sorry didn't see your answer on page two before posting this! I've now unistallaed everything and reinstalled Interbase XE 64 and Lazarus 64. I still can't connect though.  I get "Connection rejected by remote interface".  It appears to be trying to connect now, the gds32.dll was installed automatically by Interbase to both locations so I assume one is for 32 bit compatability and one 64. Interbase is fully licensed and works fine in IBConsole. Interestingly I then uninstalled Interbase and loaded firebird 3 64bit and dbweaver and it gets the same error trying to connect to Firebird.  I'll try the 2.5 and see what happens ---------------------------------------------------------------------- lindaandjon · 2016-06-28 10:32 Well, I tried all sorts of things but could never get Interbase to connect so I've installed Firebird 2.5 and IBExpert and now have a working connection with data. Thank you so much for helping me get this far, now I can get on with some programming - I wish I hadn't wasted so much time on Interbase.  As a matter of interest, why did you suggest Firebird 2.5 and not 3.0? ---------------------------------------------------------------------- rvk · 2016-06-28 10:42 Firebird 3.0 is relatively new. It also has some new features and security measures I don't know yet. If you're beginning completely new you can probably use it without a problem. It also can't open older databases yet. Firebird 3.0 creates databases with internal format ODS 12. Later version will be able to open en write to 11.x but for now you can only access a database which is made by Firebird 3.0 itself (which is not a problem if you begin new). So it might only be my inexperience with 3.0 that I suggested 2.5 ---------------------------------------------------------------------- lindaandjon · 2016-06-28 16:31 I see, that makes sense.  I'm progressing slowly with 2.5 so I will stick with it for now. Thanks again