JDBC : How to link Fast2 and SQL DB¶
To extract from or inject in a SQL DataBase, Fast2 use JDBC as a connector with SQL.
Requirements¶
To use JDBC you must download the library related to your SQL DataBase.
JDBC and SQLServer 2019¶
To begin, download the JDBC Driver for SQLServer
You must choose the right version for your JDK !
You have two ways to check it :
-
From a command line:
-
Or, check it in your Fast2:
FAST2_HOME/config/env.properties
After that you can add:
- The .jar file in your Fast2:
FAST2_HOME/Worker-libs/
- The .dll in you java folders
java/java-version/jre/bin
Use the SQL Server Configuration Manager to start the TCP port.
Example: Injection on a SQL DataBase¶
For the educational aspect of this topic, let us take this map as an example
and consider this table to inject in:
How to configure the SQLStatementTask¶
Basically, two fields are mandory:
-
The JDBC link to establish the connection between Fast2 and SQLServer. To generate it, use the Microsoft Documentation
For example, you can use :
If you do not want to put your credentials in the login URL, you can encrypt your password by entering your credentials by filling in the fields below.
-
The query to insert or update your database.
Now let's start your Fast2 map and check that your table has new values !
👏 Fast2: 1, JDBC & SQL: 0¶
Congrats, you've made it !
Now you can also use the JDBC connection for other tasks such as SQLMultiQueryTask or SQLSource.
In addition to inserting or updating your database, you can also use these tasks to remove the contents of your tables !