Jump to content
corneliusdavid

Copy Encrypted InterBase Database to another machine

Recommended Posts

Posted (edited)

I've been using a small InterBase database for testing and learning purposes while doing some mobile and web development.  I work on a Windows 10 machine and have a Windows 2016 Server, both with InterBase 2020 installed. My Windows 10 development machine has Delphi and I use the developer license for InterBase.

 

I'm also playing around with RAD Server and have gotten a small module working in RAD Server on my development machine. I'm using my one production RAD Server license on my Windows server which requires encrypted databases. I finally found the reference on how to encrypt an InterBase database and want to copy this database over to the server so I can test it out on a simulated real-world environment.

 

I created a backup of the database and copied the .ibk file over but using gbak with -sep and -eua_u and -eua_p parameters to specify the System Encryption Password and embedded user authentication is giving me this:

Quote

ERROR: encryption MYBACKUPKEY password is corrupt

When I encrypted the database, it had asked for the System Encryption Password and a Backup Encryption Password.  I entered the same for both and it allowed it to be saved and encrypted.  I also checked the box to not tie the SEP to the hardware. So why isn't this working?

 

How can I develop an encrypted database on one machine and copy it to another when it's ready for deployment?  Does the SEP have to match exactly on both machines? If so, I'll have to find another way to get the data over because I have no idea what the SEP is that RAD Server uses.

 

Edited by corneliusdavid

Share this post


Link to post

David,

The RAD Server Production license is not compatible with normal InterBase Production licenses. Even within RAD Server, there are 2 modes; development, and, production. The RAD Server database from a "development" environment cannot be just copied over to a production environment, and vice-versa.

 

Since the "development" RAD Server license does not stamp the database file with any SEP (InterBase System Encryption Password), this database file can be used with normal InterBase Developer Edition. But, when you want to work with RAD Server Production deployment, you will want to rebuild your RAD Server database in "production" mode, so it uses a database file that is already stamped with a InterBase SEP value (not known to any user); you can save data in this as allowed by RAD Server schema. You cannot use a RAD Server Single/Multi-site production license to build your own InterBase encrypted databases where you need to know the SEP value. To use your own InterBase databases with SEP/Encryption, you will need to purchase a normal InterBase deployment license for Server Edition.

 

I am sure you have already gone through the detailed demos/tutorials etc. about RAD Server. If not, here they are. Hope you find them useful.

https://blogs.embarcadero.com/new-rad-server-ems-articles-resources-and-ebook/

https://cc.embarcadero.com/item/30879

 

In summary, if you want to create your own database schema with InterBase encryption, you will need to buy InterBase Server Edition license. If you want to use RAD Server license to store data as per RAD Server guidelines, you will not have access to any SEP value as that is hidden in RAD Server, to be available only for RAD Server database files (automatically). You can use a RAD Server database file with normal InterBase license, and vice-versa.

 

Should you have any specific questions that we can help answer, please contact Embarcadero Support team at https://www.embarcadero.com/support. I am sure they can guide you further effectively. Also, please note that some of the documentation above do refer to InterBase 2017 from some years ago; current RAD Server uses the latest InterBase 2020 version, but the documentation still applies. Also, any reference to "purchase" a RAD Server deployment license is old (from many years ago); I understand RAD Studio Enterprise/Architect users get a deployment license for RAD Server included.

 

Thanks.

~Sriram

Share this post


Link to post

Sriram,

 

Thank you so much for your detailed response. I had indeed read every link and technical resource I could find, even scanned all through David I's book. I found and learned lots of information but never found anything about using InterBase as the database for installed RAD Server modules--I just assumed it would be possible as it seems like the natural choice for RAD Server modules.

 

In my opinion, this seems wrong (or greedy). They promote RAD Server which uses encrypted InterBase and they promote the use of InterBase for your applications.  But when you install RAD Server and InterBase together, fully licensed with RAD Server, you can only use RAD Server, you can't use the fully capable, licensed, running InterBase without purchasing another license. I could understand restricting InterBase use only through RAD Server modules but I guess that might be technically difficult to enforce.

 

Thanks again!

 

  • Like 1

Share this post


Link to post

So, I was writing up a blog about this after I had completely uninstalled all InterBase versions that were not installed by RAD Server and wanted to grab a screenshot from one of the errors, so quickly reinstalled IB and created a quick test database to see the error but this time it worked. The only difference (that I can think of) was that I did not use a database alias to connect!

 

My blog now proclaims that that you CAN use a development license of InterBase in addition to an InterBase instance using the production version of RAD Server.

 

I had been using IBConsole to create and connect the databases and am now very leery IB aliases and any error message in IBConsole as I believe (and have seen reports elsewhere) that it has a lot of bugs.

 

My one remaining question now is this: Is what I have done a violation of licensing? My home Windows Server is for development and testing so applying the developer license of InterBase should not be a problem. I don't have a use for the production license of RAD Server with a customer and would like to test applications with more than 5 users, so figured it wouldn't be a problem to use it on my Windows server alongside development databases.

 

Perhaps that's not what was intended for Delphi Enterprise users but I did not see any restriction mentioned in the EULA on where that license could be used (except within the same country you purchased it).

Share this post


Link to post

@corneliusdavid, thank you for posting your blog article in your response above. Now, I understand your issue a bit better. I am sorry you had a lot of difficulty using the product for your intended purpose.

 

Here are a few things I want to clarify...

  1. You can use *any* number of InterBase instances on a single machine, as long as each of these instances are licensed and registered with a unique S/N
  2. Each InterBase instance has to be uniquely identified on your machine; this is typically the instance name you provide when you are installing either the normal InterBase product, or RAD Server (same installer as InterBase). The unique identification combination is the (1) instance name, and, (2) TCP/IP socket listening port for the InterBase server process. Each InterBase server instance will listen on their own unique socket port.
  3. Each install of InterBase (and RAD Server) comes with its own set of InterBase command-line tools, IBConsole, IBMgr, ibserver.exe etc. They are self-contained with their own user authentication database, admin.ib. The server instances do not share any database user accounts outside their own instance.
  4. On a single machine, you *can* have a mix of InterBase Developer Edition (downloaded from the product portal), InterBase Server Edition, RAD Server (production S/N), RAD Studio installed InterBase Developer IDE Edition (automatic install, optional in RAD installer) etc. And, you can install any number of InterBase versions as well, with any combination of Editions, provided you follow rule (2) above.
  5. If your InterBase Developer Edition or Server Edition has been used to Encrypt databases with their own SEP and Encryption keys, just remember that these databases should *not* be used with RAD Server (production) instance of InterBase; and, vice-versa, you should not try to access your RAD Server (production) databases from InterBase Developer Edition or Server Edition. The Developer Edition and Server Edition server instances do not know what the SEP should be to connect to your RAD Server (production) databases (as designed). 
  6. By no means should a new install of InterBase should interfere with your current databases in use (by other instances), as long as you have not broken rule (2) above.
  7. From your application(s), my recommendation would be to use the TCP/IP localhost loopback going to that specific InterBase instance you want to connect. For e.g. your database URL would look like "localhost/<instance_name/portNumber>:<database_filepath>", as in "localhost/14064:C:/mypath/foo.ib", or, "localhost/gds_db:C:/mypath/foo.ib", or "localhost/ib2020:C:/mypath_ib2020/ib2020file.ib" etc.
  8. There is only one IBConsole.xml file used to store all configurations for the  end-user of the system. So, I would always just launch the IBConsole from the most recent InterBase installation on your system, as this would have the most up-to-date feature set, and bug fixes. Whenever you install a new version of InterBase that supersedes other versions on your machine, just make a shortcut to the IBConsole from that install and launch that.
  9. In your IBConsole, when setting up a connection to a local/remote server, I would normally choose the localhost/loopback TCP/IP setup rather than the "Local Server" (IPC) connection. This helps me clearly identify which InterBase instance I am connecting to by specifying the instance name or the TCP port ID of the listening server. When you now use "Alias" (some more bugs for this are fixed in an upcoming release), the database alias is maintained in that InterBase server instance's admin.ib (user authentication database, stated above).
  10. For the InterBase Developer edition installed by RAD Studio, use the RAD Studio License Manager to manage it's licenses. For all other InterBase instances (including RAD Server production license), use the License Manager that is installed with InterBase (you can get it in the Windows shortcuts setup with your InterBase instance).

Once you have done the above, please post any new observations. We can take it on from there, as this post is getting a bit long already. 🙂

 

Good luck!

 

Best wishes,

Sriram

  • Like 1

Share this post


Link to post
On 8/15/2021 at 3:44 PM, corneliusdavid said:

 

My one remaining question now is this: Is what I have done a violation of licensing? My home Windows Server is for development and testing so applying the developer license of InterBase should not be a problem. I don't have a use for the production license of RAD Server with a customer and would like to test applications with more than 5 users, so figured it wouldn't be a problem to use it on my Windows server alongside development databases.

 

Perhaps that's not what was intended for Delphi Enterprise users but I did not see any restriction mentioned in the EULA on where that license could be used (except within the same country you purchased it).

@corneliusdavid, The RAD Server production license you get with your RAD Studio Enterprise can definitely be used in the scenario mentioned above. I do not see any violation of licensing/EULA.

Share this post


Link to post
22 minutes ago, Sriram said:

Each InterBase instance has to be uniquely identified on your machine; this is typically the instance name you provide when you are installing either the normal InterBase product, or RAD Server (same installer as InterBase). The unique identification combination is the (1) instance name, and, (2) TCP/IP socket listening port for the InterBase server process. Each InterBase server instance will listen on their own unique socket port.

Yes, that's what I had done. Originally, as mentioned in the blog, I had IB XE7 and IB 2017 installed both listening on different ports. I installed RAD Server and its IB 2020, all using TCP/IP and without changing anything with the first two installs, could no longer access the XE7 or 2017 instances. I'm not sure what happened but I know it was installed in its own directory and was using a different port.

 

31 minutes ago, Sriram said:

By no means should a new install of InterBase should interfere with your current databases in use (by other instances), as long as you have not broken rule (2) above.

Thank you very much for the detailed response on being able to use multiple instances of InterBase on the same machine. I'm pretty sure I followed rule #2 above. I'm accustomed to carefully configuring ports and have used multiple databases and even stand-alone and web-based servers on the same machine before, all without conflict.

 

35 minutes ago, Sriram said:

There is only one IBConsole.xml file used to store all configurations for the  end-user of the system. So, I would always just launch the IBConsole from the most recent InterBase installation on your system, as this would have the most up-to-date feature set, and bug fixes. Whenever you install a new version of InterBase that supersedes other versions on your machine, just make a shortcut to the IBConsole from that install and launch that.

That's good to know.  I had gone looking in the Windows registry for settings to see if something had gotten clobbered. One weird problem I noticed was when I tried to use a different style. I got more error messages until I switched back to the standard Windows style.  I thought that was really weird as I can't imagine how the style would affect database connections.

 

After discovering IB 2020 Developer does work with RAD Studio's IB 2020 on a different port, and after continuing to have intermittent problems with IBConsole, I switched to a different client database program, IBExpert, and it works flawlessly. So I think most of my problems stemmed from using IBConsole--and I will avoid using that completely from now on if I can.

 

Thanks again for your response and thorough answers.  I really appreciate it. 🙂

 

Share this post


Link to post

Your problem could come from the gds32.dll client file. If it's in the windows\system32 folder it will be overwritten with each installation. Not all of them have been backward compatible.

Share this post


Link to post
17 minutes ago, Hans J. Ellingsgaard said:

Your problem could come from the gds32.dll client file.

Thanks. I have two instances of IB installed on my Windows server, both 2020. I had updated the RAD Server one recently with last October's update but forgotten to do the other one until you mentioned it. However, the most recent gds32.dll was already in the Windows\SysWOW folder.

 

I tried IBConsole from the server again just now and it seems to be working again. 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×