Hi,
you are declaring your stmt variable twice. This is not allowed.
Just use name stmt.
Check below to find the error
Olli
> >
> > package net.reumann;
> >
> > import java.io.*;
> > import java.util.ArrayList;
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> > import java.sql.*;
> > import javax.sql.*;
> > import net.reumann.*;
> > import org.apache.struts.action.Action;
> > import org.apache.struts.action.ActionForward;
> > import org.apache.struts.action.ActionMapping;
> > import org.apache.struts.action.ActionForm;
> > import org.apache.log4j.*;
> > import org.apache.commons.beanutils.BeanUtils;
> >
> >
> > public class OrgIdService implements Serializable {
> >
> > //Declare and initialize variables
> > Connection conn = null;
> > Statement stmt = null;
> > ResultSet rs = null;
> > ArrayList facilList = new ArrayList();
> >
> > //The execute() method of OrgIdService is called by OrgIdAction to
> > execute a query against the SS Test DB
> > public ArrayList execute(DataHash beanHash) {
> >
> > //Get mode from DataHash
> > int mode = beanHash.getMode();
> >
> > try{
> > switch (mode) {
> > case 0:
> >
> > Class.forName("oracle.jdbc.driver.OracleDriver");
> > conn =
> >
> DriverManager.getConnection("jdbc:oracle:thin:@sources:1521:TEST","Test123
> > 4","Test1234");
//here you declare stmt
> > Statement stmt =
> > conn.createStatement();
> > ResultSet rs =
> > stmt.executeQuery("SELECT DISTINCT FACIL_ID FROM FACILITY");
> >
> > //Read ResultSet into instance of
> > FacilBean and add to facilList Array object
> > while (rs.next()) {
> > FacilBean facil = new
> > FacilBean();
> >
> > facil.setFacilId(rs.getString("FACIL_ID"));
> > facilList.add(facil);
> > }
> >
> > //Close ResultSet and Connection
> > objects
> > rs.close();
> > conn.close();
> > case 1:
> > //Extract the facilId from the
> > DataHash to query the FACILITY table
> > String facilId = (String)
> > beanHash.get("FacilId");
> >
> >
> > Class.forName("oracle.jdbc.driver.OracleDriver");
> > conn =
> >
> DriverManager.getConnection("jdbc:oracle:thin:@sources:1521:TEST","Test123
> > 4","Test1234");
here again
> > Statement stmt =
> > conn.createStatement();
> > ResultSet rs =
> > stmt.executeQuery("SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID
> > FROM FACILITY WHERE FACIL_ID = '" + facilId + "'");
> >
> > //Read ResultSet into instance of
> > FacilBean and add to facilList Array object
> > while (rs.next()) {
> > FacilBean facil = new
> > FacilBean();
> >
> > facil.setFacilId(rs.getString("FACIL_ID"));
> >
> > facil.setFacilName(rs.getString("FACIL_NAME"));
> >
> > facil.setFacilName(rs.getString("FACIL_NAME_SHORT"));
> >
> > facil.setOrgId(rs.getString("ORG_ID"));
> > facilList.add(facil);
> > }
> >
> > //Close ResultSet and Connection
> > objects
> > rs.close();
> > conn.close();
> > default:
> > return null;
> > }//end Switch
> > }//end try
> > catch (Exception e) {
> > return null;
> > e.printStackTrace();
> > }//end catch
> >
> > //Return facilList Array Object to OrgIdAction
> > return facilList;
> > }//end Execute () method
> > }//end class
>
--
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--------------------------------------------------
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualit�tssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]