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 system settings 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

When starting BL Banking, the message When opening the database, the following error occurred: …. The database cannot be opened. What does this mean?

Depending on the database, the text of the error message may vary.

Sample message from a MySQL database:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The cause can be found in the database server. As a system administrator, check the following:

See also FAQ 164.

FAQ 160

When starting BL Banking, after the message stating that the database could not be opened, the error message Database may be already in use is displayed. What does that mean?

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

See also FAQ 160.

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