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 may contain a Java action or expression that you can read and use in your model. If a cell contains a stochastic expression that you want to use as a flowchart block property value, simply select that cell. AnyLogic will retrieve the expression from the database, evaluate it, and use the result as the property value.
Starting with version 8.9.4, you can also execute a Java action or evaluate an expression stored in a Code type cell by calling execute(this) on that cell. The expression or action is retrieved from the database and executed.
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?