Hi everyone,
how to do a select * from table
in jython and get the result for each row into a list or string.
i know how to do for select counmn_name1 ,column_name2 from table1 but not able to figure out for select *
Please suggest .thanks
Hi everyone,
how to do a select * from table
in jython and get the result for each row into a list or string.
i know how to do for select counmn_name1 ,column_name2 from table1 but not able to figure out for select *
Please suggest .thanks
If you use JDBC then you can use JDBC ResultSetMetaData interface:
rs = c.executeQuery("SELECT * FROM a_tmp_table")
while (rs.next()):
rsmd = rs.getMetaData()
print('columnCnt: %d' % (rsmd.getColumnCount()))
for i in range(rsmd.getColumnCount()):
print(rs.getString(i + 1))
If you use zxJDBC (comes with Jython) then you can follow the cross-implementation DB-API protocol to execute queries and retrieve results.