Good News Everybody!
The new search engine is LIVE!
Please report any problems to david (at) midrange.com.
|
On Wed, 22 Dec 2004 13:58:55 -0000, Anand, Rajesh <Rajesh_Anand@xxxxxx> wrote:
>
> Folks,
>
> This is the copy of the source that I ran on AS400.
>
> One thing I know for sure is that it gives error on the
> highlighted statement below....
>
> import java.io.*;
> import java.sql.*;
> import java.text.*;
> import java.util.*;
>
> import org.jdom.output.*;
> import org.jdom.input.*;
> import org.jdom.*;
> import org.jdom.transform.*;
> import org.jdom.contrib.input.*;
> import com.ibm.as400.access.*;
>
> public class createFsaxml
> {
> Element elcct = null;
> Element elpt = null;
> ResultSet rs = null;
> Document doc = null;
> PrintWriter pw = null;
> Element rootelem = null;
>
> public createFsaxml() throws Exception{
>
> try{
> // register driver
>
> DriverManager.registerDriver(new
> com.ibm.as400.access.AS400JDBCDriver());
>
> Connection c =
> DriverManager.getConnection("jdbc:as400://mldev400/SPANAND");
>
> System.out.println("Got connection.. processing");
>
> Statement stmt = c.createStatement();
>
> ResultSet rs = stmt.executeQuery("Select * from GMISFAF1");
>
> System.out.println("Got Query results");
> System.out.println("Trying to create XML file");
>
> createxml();
>
> c.close();
> } catch(SQLException e){
> System.out.println(e);
> }
> }
>
> public void createxml() throws Exception{
>
> int cntr = 0;
>
> Document doc = new Document();
>
> Element rootelem = new Element("FSArootElement");
>
> doc.setRootElement(rootelem);
>
> try{
>
> PrintWriter pw = new PrintWriter(new BufferedWriter(new
> FileWriter("/java/demo/fsa.xml")));
>
> while (rs.next()){
I dont see any highlighted statement, but ill give it a shot...
in this last line of code, you are attempting to access the member
variable 'rs' which has not yet been initialized. In the
createFsaxml() method you create and instantiate a new ResultSet
object with the name rs, but it its local to that method.
Hth,
Carl.
This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.