AnyLogic
Expand
Font size

AnyLogic DB data types

The data in AnyLogic model database can be of different types:

Data type Description
boolean Boolean value.

Valid values:
true
false

Is used to map from SQL type:
DOUBLE
int Integer value.

Valid values:
-2147483648 to 2147483647

Is used to map from SQL type:
INTEGER
double A floating point number.
Is used to map from SQL type:
DOUBLE
String Text string.
Is mapped to SQL type:
VARCHAR
Date The timestamp data type. The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn].
Is mapped to SQL type:
TIMESTAMP
Code Table cells contains Java action, or Java expression that you may read and use in your model.
If the cell contains some stochastic expression, and you want to set it as a value of some flowchart block parameter, just select this particular cell in the block properties, and AnyLogic will automatically take the expression from the database, evaluate it, and use the expression result as the parameter value.
Or, if the cell contains Java action, you can execute this action by calling the function execute() for this cell.
Other Choosing Other option, you can specify any other SQL data type you need, for example:
  • NUMERIC
Other data types relating to time:
  • DATE — The date data type. The format is yyyy-MM-dd.
  • TIME — The time data type. The format is hh:mm:ss.
Integer data types:
  • BIGINT — Valid values: -9223372036854775808 to 9223372036854775807.
  • TINYINT — Valid values: -128 to 127.
  • SMALLINT — Valid values: -32768 to 32767.
Floating point data types:
  • REAL — A single precision floating point number.

Since SQL data types and Java data types are not identical, there needs to be some mechanism for reading and writing data between AnyLogic and a database using SQL types.

JDBC provides a standard mapping from the common SQL data types to Java types. For example, a SQL INTEGER is normally mapped to a Java int. This supports a simple interface for reading and writing SQL values as simple Java types.

How can we improve this article?