InterBase database migration to MySQL (restore Backup)

Source: Internet
Author: User
Tags firebird database interbase gsec

I got the database backup file of the ". GBK" suffix of interbase export, the target can be imported to the specified database by command line, in this script I use the "Gbak" command line in the InterBase database to operate.

First of all to introduce this InterBase database, http://baike.baidu.com/item/interbase?fr=aladdin--Baidu Encyclopedia, roughly speaking is a kind of file database, And because I can not find the corresponding installation package on Ubuntu, so take interbase corresponding open source version Firebird database to practice, of course, because this program is running on the Windows platform, the last operation I was on the Windows7, Just for the first experiment convenient on the Linux operation (Linux on the package and software installation is not a general convenience), as for the relationship between Firebird and InterBase can see Baidu encyclopedia--http://baike.baidu.com/view/ 424640.htm?fr=aladdin.

The InterBase Bin directory has a Gbak program that is responsible for database backup operations. The specific commands are as follows:

" SYSDBA " " Masterkey " " %PATH%\DBANME.GBK " " 127.0.0.1:%PATH%\DBANME.GBK ' "
Gbak <options>-user <username>-password <password> <source> <destination>

In the InterBase database, the default user name is "SYSDBA", the default password is "Masterkey" after the two parameters are the address to be entered, one thing to note is that the second parameter in front of the drive letter with an IP address, if local is "127.0.0.1" , if not added will be an error.

In the installation of Firebird will use the GSEC command, GSEC is the Firebird database user Password management tool, it is very likely that there will be no default user name password on Linux, if so, use the password change password to modify the new password. The code for the program is attached below:

#Encoding=utf-8Importos,sys,getoptopts, args= Getopt.getopt (sys.argv[1:],"hg:b:",[" Help","gbk=","gdb="]) Input_file=""output_file=""defusage ():Print """- h--help Print the Help-g--gbk the path of the backup File-b--gdb Has to backup the database path""" forOP, valueinchopts:ifOpinch("- G","--GBK"): Input_file=valueelifOpinch("- b","--gdb"): Output_file=valueelifOpinch("- H","--help"): Usage () sys.exit ()#Input_file The address of the backup file to be imported#Output_file The address of the database to be restored#SYSDBA is the default account name for the InterBase database#Masterkey is the default password for the InterBase databasedefMain ():ifOs.path.isfile (input_file): Os.system ('gbak-c-user "sysdba"-password "Masterkey" "'+input_file+'"" 127.0.0.1:'+output_file+'"')    Else:        Print 'Error:file does not exist'if __name__=='__main__': Main ()

InterBase database migration to MySQL (restore Backup)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.