In this blog, I will explain you how to create JDBC alias (cloud/on-premise) connection and perform some basic SELECT, INSERT and DELETE Operations.
How to create JDBC Connection alias..?
In real-time, you will get DB details either from infra-team or admin team..
Basically, you need DB Host, Port, User-Name, Password and Database name.
and based on the data base, you need to prepare JDBC URL.
Go to Monitor>Integrations and APIs>Manage Security> JDBC Material
Click on Add, select Database type "PostgreSQL" or SAP HANA Cloud or SAP HANA Platform (On-Premise)..etc
Note: If the Database is On-Premise, then you need to install JDBC Driver.
Specify all the required details and Deploy the connection and note the connection alias name.
In my example, the connection alias is "postgresql_db"
For PostgreSQL, the JDBC URL is ..
JDBC URL: jdbc:postgresql://host:port/database
Based on your database, you need to build the URL (if you're not sure, just google it) :-)
Next, create simple iFlow as shown below..
Inside Content Modifier step, specify your SQL query.
select * from "doc"."emprecord" limit 100;
where "emprecord" is the table name, you need to change it as per your table name.
Content Modifier Step:
Once flow is ready, then deploy it and test it.
DB results:
Sample queries for your ref:
- create table emprecord( empid int, emplastname varchar(255), empfirstname varchar(255), empage int);
- insert into "doc"."emprecord"(empid,emplastname, empfirstname, empage) values (1003,'HHR','Lalit',25);
- select empid,emplastname,empfirstname, empage from "doc"."emprecord" limit 100;
- select * from "doc"."emprecord" limit 100;
Thanks for reading :-)
No comments:
Post a Comment