Connect custom DB Version 10 (Java)
Action group: DB General
Description
The action connects to database with set connection parameters.
More details can be found here: Instruction on Connecting to Microsoft SQL Server from Robin Studio
Action icon
Parameters
Input parameters
Transaction isolation level - isolation level of access to the database during the execution of transactions.
Login – login to connect to database.
Password – password to connect the database.
DB server URL – the URL of the server where the database is located.
Driver class full name – driver class full name for the set database.
The driver classpath for the specified database - the driver classpath for the specified database.
Timeout - Time limit for connection creation to database.
Output parameters
As a result, we get connection context to the selected database.
Settings
Property | Description | Type | Filling example | Mandatory field |
---|---|---|---|---|
Parameters | ||||
Transaction isolation level | Isolation level of access to the database during the execution of transactions. Dropdown list: No transactions, Read uncommiеted, Read committed, Repeatable read, Serializable | Robin.String | No | |
Login | Login to connect the database | Robin.String | No | |
Password | Password to connect the database | Robin.Object | No | |
DB server URL | The URL of the server where the database is located. Examples: jdbc: h2: mem: h2inmem; jdbc: sqlite: C: Users User1 test.db | Robin.String | Yes | |
Driver class full name | Driver class full name | Robin.String | Yes | |
The driver classpath for the specified database | The driver classpath for the specified database | Robin.FilePath | Yes | |
Timeout | Time limit for connection creation. Further it is used as the maximum waiting time for the execution of requests in the connection. The default is 60 s. May depend on driver implementation. | Robin.Numeric | No | |
Results | ||||
DB context | Connection context to the selected database | Robin.DbContext | Database context |
Special conditions of use
The difference between a custom connection and a standard connection is that with the standard connection you can connect to only one of four available databases (Oracle, MySql, PostgreSql,MsSqlServer), with the custom connection you can connect to any database for which the jdbc-driver is installed.
Example of use
Task
Connect to database and execute statement.
SELECT * FROM Table1
ORDER BY id ASC;
Solution
Use the "Connect custom Db", " Execute Sql Statement" actions.
Реализация
- Assemble a robot scheme with the actions:
- Set the "Connect Custom Db" action parameters.
Transaction isolation level - isolation level of access to the database during the execution of transactions. Dropdown list:- no transactions
- read uncommitted allowed - it will be allowed to read data that is modified by some other transaction.
- read committed - the robot will only be allowed to read the recorded entries.
- repeatable read - the robot will only be allowed to read the recorded entries. The data that the robot is currently reading cannot be changed by another entity until the robot's transaction is complete.
- serializable - the robot will only be allowed to read the recorded entries. The data that the robot is currently reading cannot be changed and/or read by another entity until the robot's transaction is complete.
- Specify the database login and password.
In the "DB server URL" specify the URL of connection to the required database. All additional parameters must be specified in the server URL.
When using a custom connection, the driver for the database must be downloaded. The driver file must be located on the same machine where the program robot is running. This driver will be used to connect the robot to the database.
In "The driver classpath for the specified database" field set the name of the driver class. You can find it on the Internet, i.e. look up the driver name for the database you are using. Accordingly, for each type of database the driver class name will be different.
In "The driver classpath for the specified database" field, specify the path to the driver file that will be used to make the connection. For example:
Value in the "Timeout" field is measured in seconds. - Set the "Execute statement" action parameters.
- Click "Start" in the top panel.
Result
The program robot completed successfully. The statement was executed.