Wagby can use various databases. This guide explains notes and troubleshooting when using each database.
Save the database driver file provided by each database vendor in the following folder.
For example, when using Oracle, the file Wagby - 7.xx/customize/tomcat/lib/ojdbc7.jar must be copied.
The "database URL" item is supplemented by the database to be used.
Change the character string portion of "[host name]" to the host name or IP address of the database server and the character string portion of "[DB name]" to the name of the database (prepared in advance).
When installing the Web server and database server on the same machine, specify "hosthost" part as "localhost".
The method of describing the connection URL to each database when the host name is "localhost" and the database name prepared on the database side is "sampledb" is as follows.
When switching databases, full build is required.
(Full Build is needed only once for the first time you switch databases.After switching databases, you can use ordinary differential builds.)
If you are using R7.0 to R7.3.1, please change the file name according to the following naming convention after placing the database driver.
|Database||Database driver file name (after renaming)|
|Oracle 9i/10g/11g/12c||Ojdbc14.jar (Please rename it to ojdbc14.jar instead of ojdbc5.jar/ojdbc6.jar/ojdbc7.jar)|
|SQLServer 2005/2008/2012/2014||Sqljdbc.jar (Please rename * sqljdbc4.jar to sqljdbc.jar and use it)|
Db2jcc.jar (Please rename db2jcc4.jar to db2jcc.jar and use it)
Db2jcc_license_cu.jar (when using DB2 Connect, such as connecting to a host)
In Wagby after R7.3.2, the "rename file name" procedure described here is unnecessary.
Create a new table in the database with the import_db script after the build.We will also restore the data.
Depending on the database you use, the conversion rules for the types are different.There are also database specific restrictions.For details, please read the following contents.
For Commons DBCP, this site is helpful.
You can change the connection pooling to Tomcat JDBC Pool.In this case, the value described in the customized and saved configuration file (server.xml) is valid, not the value set in the Wagby repository.
References "What is Tomcat JDBC Pool over Commons DBCP"
If the init_db script or the import_db script fails in the middle, it is possible that the DDL instruction was executed halfway.
After that, even if deleting the table with the drop_db script does not have the necessary tables and constraints, the deletion also fails.As a result, some tables can not be deleted, resulting in an incorrect state.
In this case, please delete the table manually by using the tool of each database.For details, please read how to use the tools provided by each database.
For application swapping, it is necessary to execute export_db and drop_db in the old version and import_db in the new version after swapping.
For example, if there was a model that existed in an older version but not in a new version, you can not delete a table unless you use old-version drop_db.
Start Wagby applicationBeforePlease make sure that the database is running.If this order is reversed, the Wagby application can not connect to the database.[Reference database environment> Enable database automatic reconnection]
If an error occurs when using an external database, please follow the procedure below.
Wagby automatically generates DDL such as create table statement and drop table statement from model definition.This uses Hibernate's function.Specifically, it is generated from the Hibernate mapping file (.hbm.xml).
The order of items in DDL is not the item order of the model definition.It will be in the order of Hibernate mapping file.
The automatically generated DDL file is saved in the following folder.
Hibernate automatically generates the part of "drop constraint FKXXXX" which corresponds to FKXXXXX.Wagby does not control it in particular.