• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC ans Stored Procedures

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am using the following code :

public HashMap getSkillsList(String msId) throws Exception
{
Connection conn = null;
CallableStatement cs = null;
ResultSet rs = null;
HashMap skillsListMap = null;

String skill = null;
int i = 1;

try
{
skillsListMap = new HashMap();

conn = SkillsDBConnection.getConnection();
cs = conn.prepareCall("{call P_SKILL_ID (?,?)}",ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

cs.registerOutParameter(1,OracleTypes.CURSOR);
cs.setString(2,msId);
cs.execute();

rs = (ResultSet)cs.getObject(1);
//rs.next();

while (rs.next())
{
if ((null != rs.getString(1)) && (null != rs.getString(2)))
{
System.out.println("Skill Name : " + rs.getString(1));
System.out.println("Skill Id : " + rs.getString(2));

skill = rs.getString(1);
skill = skill + "~" + rs.getString(2);

System.out.println("Skill : " + skill);

skillsListMap.put("" + i, skill);
++i;
}
}
} catch(Exception e) {
e.printStackTrace();
} finally {
rs.close();
cs.close();
conn.close();
}
return skillsListMap;
}

I am unable to make the ResultSet scrollable.Can anyone help me in resolving the issue of making the resultset scrollable?A example would be much better.Thanks in advance.
 
reply
    Bookmark Topic Watch Topic
  • New Topic