gatelead
February 22nd, 2000, 03:29 PM
Does anyone out use JAVA for anything other than applets and such..
Question:
I've been given a task at work to write a JAVA program to manipulate an SQL compliant database.
I have all the code pretty much written. The problem is that. I use prepared statements because values will be determined at runtime. The first time through the loop I get a ResultSet just fine but the second time through I error because an instance of statement is in use. Is there a way to for this too work.. here's a snippet of the code:
public ResultSet getPerson()
{
try{
PreparedStatement pstmt =
conn.prepareStatement(Someqry);
pstmt.setString(1,xxxxx);
return ( pstmt.executeQuery() );
}catch(SQLException e){//todo:}
}
static public void main(...)
{
DBint db = DBint();
do{
ResultSet rset = db.getPerson();
//crashes after first read..
.
}while(....)
}
Question:
I've been given a task at work to write a JAVA program to manipulate an SQL compliant database.
I have all the code pretty much written. The problem is that. I use prepared statements because values will be determined at runtime. The first time through the loop I get a ResultSet just fine but the second time through I error because an instance of statement is in use. Is there a way to for this too work.. here's a snippet of the code:
public ResultSet getPerson()
{
try{
PreparedStatement pstmt =
conn.prepareStatement(Someqry);
pstmt.setString(1,xxxxx);
return ( pstmt.executeQuery() );
}catch(SQLException e){//todo:}
}
static public void main(...)
{
DBint db = DBint();
do{
ResultSet rset = db.getPerson();
//crashes after first read..
.
}while(....)
}