Hello everybody,
 I am trying to execute multiple queries as follows.
 
public GetMoreResultSet()throws Exception
 {
  Class.forName("oracle.jdbc.driver.OracleDriver");
  Connection conn=DriverManager.getConnection("url");
  String sqlQueries = "select count(*) as count1 from p1_upload_info ; select count(*) as count2 from p2_upload_info ";
  
  PreparedStatement stmt = conn.prepareStatement(sqlQueries);
  
  boolean bool = stmt.execute();
  
  ResultSet rs1 = stmt.getResultSet();
  rs1.next();
  int count1 = rs1.getInt("count1");
  rs1.close();
  // advance to the next ResultSet
  stmt.getMoreResults();
  ResultSet rs2 = stmt.getResultSet();
  rs2.next();
  int count2 = rs2.getInt("count2");
  rs2.close();
  // output results
  System.out.println("table1 has a count of : " + count1);
  System.out.println("table2 has a count of : " + count2);
  // close remaining database objects
  stmt.close();
  conn.close();
 }
 
 
But the above code is giving me Invalid Character error.  If i remove the semi colon from sqlQueries variable than it gives me
error "SQL command not properly ended "
I am using jdbc 2.0 (classes 12.zip ).
can anybody help me to sort this problem.
 
Thanx & Regards,
Prashant S.
 
 
IndiaIdeas.com Ltd.,
E-510, Crystal Plaza,
Andheri Link Road,
Andheri (W),Mumbai 400 053
INDIA
Tel:6920005/6
****************************************************************************
*************************************************************************
The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorised to receive it. It may contain confidential or legally privileged information. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. IndiaIdeas is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt.

Reply via email to