Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Multiple use of ResultSet in JDBC

Charith KulawardanaJul 30 2015 — edited Jul 31 2015

Hi experts,

I'm using Java 1.7

I'm using  following code in my project

Connection pgConn = DBConnection.getPGSQLConnection();

statement = pgConn.createStatement();

resultSet = statement.executeQuery(selectQuery);  

doc = xmlCnv.converToXML(resultSet);

What I need to do is ...


resultSet = statement.executeQuery(selectQuery);  

while(resultSet .next()){

count += 1;

}

if(count>0 ){

doc = xmlCnv.converToXML(resultSet);

}

But in here after the resultSet iterate through the while loop, it becomes null.

What I want to do is ' doc = xmlCnv.converToXML(resultSet);' part execute , if there's a records in the resultSet.

Pls guide me how to overcome this issue

Thanks

Charith

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 28 2015
Added on Jul 30 2015
6 comments
702 views