Help needed to retrieve data from oracle database

Hi there,
Greetings!

In my project, we are supposed to validate the Oracle database after a transaction completion on UI.

I used the below script to connect to the Oracle db.

public class oracleDBTest {

private static Connection connection = null;

//Establishing a connection to the DataBase

def connectDB(String username, String password){

String conn = ‘jdbc:oracle:thin:@…’

if(connection != null && !connection.isClosed()){

connection.close()

}

connection = DriverManager.getConnection(conn, “username”, “password”)

return connection

}

}

It gets connected successfully to the db.

But, I am unable to retrieve any data afterwards. I am not quite sure about the query that I need to use.
I have tried the below query, but it’s not the right one.

@Keyword
def executeQuery(String event) {
Statement stm = connection.createStatement()
String query = “select EVENT_ID, Event_name from Tablename where Event_name = '”+event+"’ and COMPANY_ID = 561"
ResultSet rs = stm.executeQuery(query)
return rs

}

Please let me know the solution for this.

Thank you so much in advance.

Hi there…
Greetings!
Can anyone please help me with my issue please…

In my project, we are supposed to validate the Oracle database after a transaction completion on UI.

I used the below script to connect to the Oracle db.

public class oracleDBTest {

private static Connection connection = null;

//Establishing a connection to the DataBase

def connectDB(String username, String password){

String conn = ‘jdbc:oracle:thin:@…’

if(connection != null && !connection.isClosed()){

connection.close()

}

connection = DriverManager.getConnection(conn, “username”, “password”)

return connection

}

}

It gets connected successfully to the db.

But, I am unable to retrieve any data afterwards. I am not quite sure about the query that I need to use.
I have tried the below query, but it’s not the right one.

@Keyword
def executeQuery(String event) {
Statement stm = connection.createStatement()
String query = “select EVENT_ID, Event_name from Tablename where Event_name = '”+event+"’ and COMPANY_ID = 561"
ResultSet rs = stm.executeQuery(query)
return rs

}

Even I am looking for Oracle DB connection and fetching data