Creating an HSQL table (and other databases)
Scope/Lifetime |
Live system-wide (i.e. also in other profiles) and permanently (i.e. not just during the profile run/test). |
If phase 4 is activated, you already know about the option of automatically creating a database node with fields in the target structure for existing database tables (via the context menu of the target structure).
If phase 4 is activated, you also have the option to proceed the other way. That is, you can create a node with fields in the target structure and then automatically create a table in an integrated HSQL database (with fields that match the fields in your target node). This is a convenient and intuitive way to build a database structure for your profile in the background. In addition, you do not have to worry about access rights or asking your database administrator for resources. The administrator simply does not need to get involved, since you only use internal data structures for which you already have all the necessary access rights (if you have them).
The following section describes the procedure for creating an HSQL node (and thus an HSQL table).
Create a new node with any number of fields in the target structure.
Select the database alias "hsql" in the attributes of target structure node "node". This alias is already available by default.
Then you can use the context menu of the node "node" to generate an HSQL table with option "Create table".
Another dialogue opens. Click (1) "Set field name as SQL column name in fields" and (2) "Create SQL" there. After that, the field "SQL statements" below (3) is filled automatically. Use (4) "Execute SQL" to complete the process.
You have now created a functional HSQL table and your node Node with its fields is connected to it (via the node and field attributes as you know it from 'normal' database nodes).
Other database types
You can also use other databases for this mechanism instead of the internal HSQL database. Simply use the alias of the desired database instead of hsql in the above description.
How the data types of structure fields are translated for the respective data type of the selected database, see (3), can be controlled via the configuration file ./etc/admin/datawizard/db_datatatypes.properties.
# Avaiable types to define: (String, Integer, Double, Date, Boolean, TimeStamp, Float, BigDecimal, BigInteger, Blob)
# Holders which will be replaced:
# %n% for single values (length)
# %p% total number of digits
# %s% number of digits in the fractional part
#
# Composition:
# specific String of a databasedriver . datatype = String to use
#
# DB2 Datatypes
db2.String=VARCHAR(%n%)
db2.Integer=INTEGER
db2.Double=DOUBLE
db2.Date=DATE
db2.Boolean=SMALLINT
db2.TimeStamp=TIMESTAMP
db2.Float=REAL
db2.BigDecimal=DECIMAL(%p%,%s%)
db2.BigInteger=BIGINT
db2.Blob=BLOB
# MYSQL
mysql.String=VARCHAR(%n%)
mysql.Integer=INTEGER(%n%)
mysql.Double=DOUBLE(%p%,%s%)
mysql.Date=DATE
mysql.Boolean=SMALLINT(%n%)
mysql.TimeStamp=TIMESTAMP
mysql.Float=FLOAT(%p%,%s%)
mysql.BigDecimal=DECIMAL(%p%,%s%)
mysql.BigInteger=BIGINT(%n%)
mysql.Blob=BLOB
#Postgres
postgres.String=VARCHAR(%n%)
postgres.Integer=INTEGER
postgres.Double=DOUBLE PRECISION
postgres.Date=DATE
postgres.Boolean=BOOLEAN
postgres.TimeStamp=TIMESTAMP
postgres.Float=REAL
postgres.BigDecimal=NUMERIC(%p%,%s%)
postgres.BigInteger=BIGINT
postgres.Blob=BYTEA
# MariaDB
mariadb.String=VARCHAR(%n%)
mariadb.Integer=INTEGER(%n%)
mariadb.Double=DOUBLE(%p%,%s%)
mariadb.Date=DATE
mariadb.Boolean=SMALLINT(%n%)
mariadb.TimeStamp=TIMESTAMP
mariadb.Float=FLOAT(%p%,%s%)
mariadb.BigDecimal=DECIMAL(%p%,%s%)
mariadb.BigInteger=BIGINT(%n%)
mariadb.Blob=BLOB
#Oracle
oracle.String=VARCHAR2(%n% CHAR)
oracle.Integer=INTEGER
oracle.Double=DOUBLE PRECISION
oracle.Date=DATE
oracle.Boolean=SMALLINT
oracle.TimeStamp=TIMESTAMP
oracle.Float=FLOAT
oracle.BigDecimal=DECIMAL(%p%,%s%)
oracle.BigInteger=BIGINT
oracle.Blob=BLOB
#MSSql
sqlserver.String=VARCHAR(%n%)
sqlserver.Integer=INT
sqlserver.Double=FLOAT(53)
sqlserver.Date=DATE
sqlserver.Boolean=SMALLINT
sqlserver.TimeStamp=TIMESTAMP
sqlserver.Float=FLOAT(53)
sqlserver.BigDecimal=DECIMAL(%p%,%s%)
sqlserver.BigInteger=BIGINT
sqlserver.Blob=VARBINARY(MAX)