Database

How can I start the H2 database without BL Banking?

First of all open the file jdbc.properties in a text editor. The file is located in the workspace directory. There replace the line with jdbc.url by

jdbc.url=jdbc\:h2\:tcp\://DB_SERVER/bl

where DB_SERVER stands for the name or the IP address of the computer, where the database shall run.

After that, extract the file h2-1.3.176.jar from the archive de.businesslogics.banking.database.h2_1.3.176.jar. This is located in the subdirectory plugins under the program folder of BL Banking. For this purpose use an archive program or a command line instruction, e. g.:

unzip plugins/de.businesslogics.banking.database.h2_1.3.176.jar h2-1.3.176.jar

Then start the database with an instruction from the command line, e. g. for Windows:

C:\BLBANKING\jre\bin\java.exe -classpath C:\BLBANKING\h2-1.3.176.jar org.h2.tools.Server -tcp -tcpAllowOthers -baseDir C:\BLBANKING\workspace

where the BLBANKING directory must contain the JRE, the extracted H2 file and the workspace directory.

Then a message will be output in the command line window, e. g.

TCP server running at tcp://10.0.2.15:9092 (others can connect)

Please note that the clients must have write permission on the workspace directory, as it is the case for the network installation.

FAQ 155

How can I recover a corrupt H2 database?

In rare cases in can happen that the bundled H2 database is damaged.

If BL Banking can detect the damage by itself, during startup a window with the Text The H2 database could not be opened is displayed. After clicking Yes the program automatically tries to recover the database. After a successful recovery the login window appears.

If BL Banking starts, but then you notice yourself that the database is damaged, you open the window Database in the preferences and click the button Recover the H2 database.

If the damage is not detected, but BL Banking still does not start, the recovery can be started manually by passing the parameter --h2-recovery to the program. To do so, open the command line terminal and enter the following commands. The further procedure is the same as with the automatic detection.

Windows

c:
cd \path\to\blbanking
"BL Banking.exe" --h2-recovery

Mac OS

cd /path/to/blbanking
open BL\ Banking.app --args --h2-recovery

Linux

cd /path/to/blbanking
./BL\ Banking --h2-recovery

FAQ 158

During startup the window Can not open the database appears

The error message is:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The reason for this is, that the database server (e. g. MySQL) is not started, cannot be reached, or was not configured for external access.

FAQ 160

When starting BL Banking the error message Can not open the database. appears.

Further in the error message there is: Database may be already in use.

This error message appears in multi-user installations, when a second user tries to start the program.

Please check the file jdbc.properties in the workspace directory. If you use the H2 database, the line for the URL should look as follows:

jdbc.url=jdbc\:h2\:${workspace_loc}/bl;AUTO_SERVER=true;AUTO_SERVER_PORT=9090;MVCC=true

If the part ;AUTO_SERVER=true;AUTO_SERVER_PORT=9090;MVCC=true is missing, please add it.

You can find further information on error messages of the H2 database here.

For multi-user installations an external database is recommended, e. g. MySQL. Then the line looks for example like this:

jdbc.url=jdbc\:mysql\://10.1.2.3\:3306/blbanking

where 10.1.2.3 is the IP address and blbanking the database name. Also then the line below for the driver is different:

jdbc.driver=com.mysql.jdbc.Driver

FAQ 164

How can I backup a MySQL database?

You can use the command mysqldump to backup the the MySQL database, e.g.

cd "\Program Files\MySQL\MySQL Server 5.5\bin"
mysqldump.exe -uUSER -pPASSWORD DATABASE > BACKUP.sql

To perform the backup automatically, create a script and have it executed with administrator rights by a scheduled task.

A restore can be performed interactively with the following command:

mysql.exe -u USER -p DATABASE < BACKUP.sql

FAQ 174