Returning Resultset from different DB
Hi folks,
I am working on a developing a Database Framework. The user gives information about the stored proc to execute,parameters required by the stored prc, the connection url ,credentials and database provider(which can be Oracle,SQL Server or DB2). I have to execute the query and return back the resultset to the user.
What I am interested in knowing is does each and every DB provider handles or create the ResultSet in different way?
For Example:
In oracle the Stored proc call looks like setting a registerOutParameter and then getting the ResultSet:
String query ="{call ? := myStoredProc(?)}";
CallableStatement stmt = conn.prepareCall(query);
// register the type of the out param - an Oracle specific type
stmt.registerOutParameter(1, OracleTypes.CURSOR);
// set the in param
stmt.setFloat(2, price);
// execute and retrieve the result set
stmt.execute();
ResultSet rs = (ResultSet)stmt.getObject(1);
And in SQL Server I can directly get the ResultSet by doing
ResultSet rs = stmt.executeQuery();
Also the query string will be different i.e.
String query ="{call myStoredProc(?)}"
DB2 will be same as Oracle I guess.
So my question is , is there any generic way to get the ResultSet?
Sorry if it sounds a dumb question.I am new to this arena..
Thanks in advance
Pankaj

