Writing DB query result to JSON file or TXT file is not writing the actual result

When I run the DB query and write the result to Console its working fine. When I try to write the same result to json file or text file, the result written to the file is org.ibboost.orqa.db.operations.DbReader$DBRecordsetGenerator@1bc7d83

Note; I have a very simple query which will return just one column with one row. Any Suggestion on this would be helpful?

Hi Santosh,

The simplest way is simply to use the implicit output of the previous steps, then you don’t have to think too hard about the types of objects being passed about behind the scenes.

So for example, if you had a table user with field username in a database yourdatabase it would simply be the following (assuming MySQL, obviously replace with your own connection string)

db.connect ( connectString = 'jdbc:mysql://yourhost:3306/yourdatabase' , username = 'user' , password = 'yourpassword' , session = 'db' ) 
users = db.read ( query = 'Select username from user' ) 
csv.write ( filePath = 'C:\\Temp\\orqa-query-output.csv' , separator = ';' ) 

Produces:

image

image

Cheers
Nik