Data Source commands

List Data Sources

Use the list-connections command to view the available connections. Connections are created by placing database connection details in a local file that ends with .dodeca.properties. For example, if your development Dodeca repository is in a MySQL database, you can create a local file named dev.dodeca.properties. The contents of the list-connections command would then list this as an available connection:

dshell/:>list-connections
dev.dodeca.properties

The contents of the file should can include the following values:

hibernate.connection.url = jdbc:mysql://localhost/dodeca?noDatetimeStringSync=true&useSSL=false
hibernate.connection.username = root
hibernate.connection.password = password

The hibernate.connection.url value should be a valid JDBC database URL for your database environment. You may omit the password from connection file for security purposes, in which case you will be prompted in the shell for the password to the database for the specified user. Older connection files using dodeca.datasource.url, dodeca.datasource.username, and dodeca.datasource.password remain supported as compatibility aliases.

Using a JNDI data source

Dshell can use a data source supplied by the application server instead of creating its own JDBC pool. Set hibernate.connection.datasource to the exact JNDI name configured by the container:

hibernate.connection.datasource = java:comp/env/jdbc/DodecaRepository

Do not specify hibernate.connection.url in the same connection file. When this setting is used, the application server provides the data source and its pooling behavior; Dshell and Hibernate use that data source directly and do not wrap it in Hikari or close it when the shell disconnects. The JNDI resource must be available in the runtime naming context, so the same connection file can be used in Standalone, Tomcat, or WebLogic only when that exact JNDI resource has been configured in the respective container.

Interactive connections can request a masked password with --prompt-for-password. Scripts cannot prompt and should use a secret reference instead:

connect --connection-file production.dodeca.properties \
  --password-secret-source file:/run/secrets/dodeca-password

Environment-backed secrets use --password-secret-source env:DODECA_REPOSITORY_PASSWORD. Literal passwords are not accepted by this option, and --prompt-for-password cannot be combined with --password-secret-source.

Connect to Data Source

Use the connect commmand to connect to a data source using the specified connection file. You may omit the .dodeca.properties suffix.

Encrypt Password in Data Source Connection File

You may want to encrypt the value of hibernate.connection.password in your connection file. You can use the encrypt command for this. Encrypt takes a single parameter and will output an encrypted version of the password. For example:

dshell/:>encrypt mypassword

You will receive output similar to the following:

ENC(CjzrGUAl14fEcR9Y2zo06lvlTg8fjkTd)

This entire line of text represents the value to place in your connection file. For instance:

hibernate.connection.url = jdbc:mysql://localhost/dodeca?noDatetimeStringSync=true&useSSL=false
hibernate.connection.username = root
hibernate.connection.password = ENC(CjzrGUAl14fEcR9Y2zo06lvlTg8fjkTd)

You may now connect to the data source and Dodeca Shell will use the decrypted password to connect to the Dodeca repository.