Tips for deploying InterBase client applications

Posted by on in Programming

In my recent Coderage X talk I briefly discussed deploying InterBase client applications. I had way more content than I could talk about. Here is the information I wanted to present, but didn't have time for, or went over far to quickly for my liking.

First, a review on IBLite/IBToGo licensing, as that it is the thing that people trip up over the most. If you look at the order confirmation email you got when you bought Rad Studio, or information from maintenance portal if you got your product that way, it tells you most of what you need to know. The critical parts are it tells you to go to http://reg.codegear.com to register your IBLite and InterBase ToGo Test deployment serial numbers with a registration code of 737479, and instructions for deploying the activation file you get are at http://www.embarcadero.com/ibinstructions.

You might be wondering, what is the difference between IBLite and InterBase ToGo Test Deployment? Both are the same binaries. The only difference is licensing. The primary difference is IBLite is a free deployment license whereas InterBase ToGo Test Deployment is a license to test InterBase ToGo Deployments. To fully deploy InterBase ToGo you need to purchase deployment licenses. While you can purchase InterBase ToGo licenses individually, it really only makes sense to deploy as a VAR. If you are deploying to mobile, you must be a VAR to deploy InterBase ToGo deployment licenses. For a complete discussion of the differences between IBLite and InterBase ToGo see http://docwiki.embarcadero.com/InterBase/XE7/en/Comparing_IBLite,_ToGo,_and_InterBase_Server_Edition

So, now you've created this fantastic application that uses InterBase in some manner. You should think about how your application accesses database files. If you are accessing files on a server, you might want to rely on a database alias. This way your application will not need to know the physical location of the database and it can be defined on the server. You can define an alias using IBConsole or the gsec command line tool. Using gsec to add a database alias is documented here: http://docwiki.embarcadero.com/InterBase/XE7/en/Using_gsec_to_Manage_Database_Alias If you are accessing an embedded database using IBLite/InterBase ToGo, you will want to build paths in your application which are specific to the target platform. This is discussed in the documentation here: http://docwiki.embarcadero.com/RADStudio/Seattle/en/Mobile_Tutorial:_Using_InterBase_ToGo_with_dbExpress_(iOS_and_Android)#Modify_Your_Code_to_Connect_to_a_Local_Database_File_on_Mobile

Now, how do you deploy it? The deployment manager is the first thing you should look at. To access the deployment manager select Project | Deployment, then click the Add Featured Files button.

This brings up the Add Featured Files dialog:

Does your application connect to an InterBase Server and not install the InterBase client otherwise? Then add files from the InterBase client file set. Does your application use IBLite/IBToGo? Then add files from the InterBase ToGo file set.

If you application needs a database deployed to it, then use the Add Files Button in the Deployment Manager:

If you are deploying the database to OSX, then select the OSX deployment and set the Remote Path to ContentsResoucesStartUp. For details see: http://docwiki.embarcadero.com/RADStudio/Seattle/en/App_Sandboxing_with_InterBase_ToGo_for_Mac_OS_X

If you are deploying the database to Andorid. then select the Andoid deployment and set the Remote Path to assetsinternal. For details see: http://docwiki.embarcadero.com/RADStudio/Seattle/en/Creating_an_Android_App#Loading_and_Deploying_Files

If you are deploying the database to iOS, then select the iOS deployment and set the Remote Path to StartUpDocuments. For details see: http://docwiki.embarcadero.com/RADStudio/Seattle/en/Creating_an_iOS_App#Loading_and_Deploying_Files

If you are deploying the database to Windows, then you will probably not want to set the Remote Path. In this situation, the database will reside in the same directory your executable resides.

For more details on the deployment manager see: http://docwiki.embarcadero.com/RADStudio/Seattle/en/Deployment_Manager

Once you have selected all the files you need to deploy, look to see if anything is grayed out. Most importantly, is reg_iblite.txt or reg_ibtogo.txt grayed out? If you are using IBLite/InterBase ToGo you will need one of them for licensing. If reg_iblite.txt and reg_ibtogo.txt are grayed out, return to paragraph 2 in this document about how to get these files in the right place.

Now that you have indicated the files you need to deploy, it's time to deploy them. To do so, first run PAServer. Next, select Project | Deploy. If you are deploying to Windows or OSX the scratch dir where PAServer is running will have all the files you need to deploy to another device. If you are deploying to Windows, the database will be conveniently located in the same directory where your executable resides. This process is discussed in detail here: http://docwiki.embarcadero.com/RADStudio/Seattle/en/InterBase_ToGo#Deploying_ToGo_and_IBLite_applications_to_PAServer

You should find that Windows applications run fine from the IDE without using PA Server and may wonder why that is, and why you should run PA Server on the same machine as you do development? The answers are around paths and licensing. Rad Studio includes integrated licensing for InterBase ToGo. So any InterBase ToGo/IBLite application that does not find licensing local to it's installation, will use the licensing from Rad Studio found on the same computer. Naturally, your Rad Studio licensing will not available in a deployment. Rad Studio places IBTOGO.DLL and IBTOGO64.DLL in it's path, so any executable launched from Rad Studio will find IBTOGO.DLL and IBTOGO64.DLL in the path. IBTOGO.DLL and IBTOGO64.DLL are unlikely to be in the path of your deployment. If you use PA Server you ensure you have a complete file set that you can deploy to another device.

Finally, let's look at a typical deployment on Windows.

│   ibtogo.dll
│   mydatabase.ib
│   Project1.exe

└───interbase
    │   ADMIN.IB
    │   interbase.msg
    │   license.txt
    │   oss_license_notice.txt
    │
    ├───intl
    │       gdsintl.dll
    │
    └───license
            reg_iblite.txt

The critical points to this deployment are:

  • IBTOGO.DLL is the same directory as the executable (Project1.exe). IBTOGO.DLL in the path would work as well.
  • The InterBase folder is in the same folder as IBTOGO.DLL.
  • Admin.in and InterBase.msg are in the InterBase folder.
  • The license folder is in the InterBase folder
  • The license file (reg_iblite.txt) is in the license folder.

 



About
Gold User, Rank: 35, Points: 77
Support guy since 3/18/85. It was dBASE II/III back then.

Comments