Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ballerina/io;
- import ballerinax/jdbc;
- public type EmployeeOracle record {
- string first_name;
- string last_name;
- float id;
- float salary;
- };
- jdbc:Client testDB = new({
- url: "jdbc:oracle:thin:@localhost:49161:xe",
- username: "system",
- password: "oracle",
- poolOptions: { maximumPoolSize: 1 }
- });
- public function main() {
- var dt1 = testDB->select("select * from employees", EmployeeOracle);
- if (dt1 is table<EmployeeOracle>) {
- foreach var entry in dt1 {
- io:println(entry.id + "|" + entry.first_name + "|" + entry.last_name + "|" + entry.salary);
- }
- } else {
- io:println(dt1.detail().message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement