![]() ![]() ![]() |
RAMADDA User Guide
|
The database to use and its connection parameters are specified in a .properties file, e.g., db.properties. The properties file can be placed in the ramadda home directory. To define the database just uncomment the appropriate ramadda.db properties in repository.properties, e.g.:
ramadda.db=derby #ramadda.db=mysql #ramadda.db=postgres #ramadda.db=h2And then specify the jdbc url and the login credentials. The URLS can be of the form:
jdbc:<db type>://<hostname>/<database name> jdbc:<db type>:<database name> jdbc:<db type>://<hostname>/<database name> jdbc:<db type>://<hostname>:port/<database name>If you are running the database on the same machine as RAMADDA the hostname can be "localhost". In the below examples we assume a database called "repository".
ramadda.db=mysql ramadda.db.mysql.url=jdbc:mysql://localhost:3306/repository?zeroDateTimeBehavior=convertToNull ramadda.db.mysql.user=the database user ramadda.db.mysql.password=the database password
ramadda.db=postgres #note: the jdbc url uses "postgresql" as the database type ramadda.db.postgres.url=jdbc:postgresql://localhost/repository ramadda.db.postgres.user=the database user ramadda.db.postgres.password=the database password
ramadda.db=h2 ramadda.db.h2.url=jdbc:h2:%repositorydir%/h2db ramadda.db.h2.user= ramadda.db.h2.password=
---Note: the ramadda.datetime and ramadda.double are replaced by ramadda ---with the appropriate datatype for the database being used. ---mysql has a datetime type, postgres and derby have timestamp ---we can't use timestamp for mysql because it only goes back to 1970 ---derby and mysql have double. postgres has float8What we do is use the class org.ramadda.repository.database.DatabaseManager to convert the sql text to the correct syntax of the underlying database. This is mostly done in the DatabaseManager.convertSql method.