Hi Rick,I am pasting code from program which did not work for recursion very
well. At line 13 executeQuery is returning a resultset. This is where I am
running into problem. ResultSet being a cursor I am not able to use
recursion. It would be better if I can return from executeQuery a JSON or
XML. JSON is scalar and can be manipulated freely. Is there any such way to
query the database.1 package recursion;2 import java.sql.*;3 public class
RecursiveSQL {4 public static EmpRecord databaseConnection () throws
SQLException {5      Connection c = null;6              Statement s = null;7    
        ResultSet
rs = null;8             String ename = null;9           EmpRecord emp = new 
EmpRecord();10              try
{11                     c = DriverManager.getConnection("jdbc:derby:scott");12  
                s =
c.createStatement();13                  rs = s.executeQuery("SELECT empno, 
ename FROM
EMP");14                        rs.next();15                    
System.out.println("rs="+rs.getString("ename"));16              
emp.empno = rs.getInt("empno");17                       emp.ename = 
rs.getString("ename");18            
c.close();19            } 20            catch (SQLException sx) {21             
        System.out.println ("
Database Connect SQL Exception.
");22                   sx.printStackTrace();23         }24             return 
(emp);25 }         26}thanks
for the help,BalNagendra



--
View this message in context: 
http://apache-database.10148.n7.nabble.com/Tree-view-in-Derby-Stored-Procedure-tp143909p143950.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Reply via email to