I use databasemetadata to get columns (read parameters) of a stored procedure on SQL server:
Connection connection = getConnection(); //getting the connection -
DatabaseMetaData dbMetaData = connection.getMetaData();
HashMap<String, Integer> paramInfo = new HashMap<String, Integer>();
if (dbMetaData != null){
ResultSet rs = dbMetaData.getProcedureColumns (null, null, sp_name.toUpperCase(), "%");
while (rs.next())
paramInfo.put(rs.getString(4), rs.getInt(6));
rs.close();
}
Does getProcedureColumns()
return the procedure columns in an ordered way? Meaning if in the database the stored procedure parameters are- abc(@a int,@b int,@c int)
, would I always get @a, @b and @c
in an ordered way?
If yes, is there any documentation to suggest the same?