Hello everyone. I�m still having problems with the BuscarNoticiasServlet i
posted.
THe problem is with the ResultSet thing.First i made another class just to
set some variable and get their values. Its a public class in the same
package.
Now after making the SQL connection and statement i�m trying to get my
restulset and making a loop with it in this way:
/**
* Insert the method's description here.
* Creation date: (09/11/01 13:56:10)
*/
public void obtenerNoticias() {
Statement st;
st=null;
vectorNoticias=new Vector();
System.out.println("Ahora vamos a por la SQL");
ResultSet rs;
rs=null;
try {
st = conn.createStatement();
rs = st.executeQuery("SELECT * FROM SYSTEM.EROSKI_NOTICIAS ORDER BY
fechanoticia");
System.out.println("SQL OBTENIDA");
while (rs.next()) {
Noticias temp = new Noticias();
temp=null;
System.out.println("Empezamos a fijar los datos de temp");
System.out.println(rs.getFloat("cod_noticia"));
//temp.setCod_noticia(rs.getFloat("cod_noticia"));
//temp.cod_noticia=rs.getFloat("cod_noticia");
System.out.println("OK");
System.out.println(rs.getString("destacado"));
System.out.println(rs.getString("TITULO"));
//String pdestacado=rs.getString("destacado");
//Noticias temp = new
Noticias(rs.getString("destacado"),rs.getString("titulo"));
System.out.println("Un campo fijado");
temp.setEntradilla(rs.getString("entradilla"));
temp.setEntradillaCat(rs.getString("entradillacat"));
temp.setEntradillaEus(rs.getString("entradillaeus"));
temp.setEntradillaGal(rs.getString("entradillagal"));
temp.setEntradillaIng(rs.getString("entradillaing"));
temp.setEntradillaVal(rs.getString("entradillaval"));
temp.setFecha(rs.getString("fecha"));
// temp.setNegocio(rs.getString("negocio"));
// Todav�a no tenemos columna negocio
temp.setTexto(rs.getString("texto"));
temp.setTextoCat(rs.getString("textocat"));
temp.setTextoEus(rs.getString("textoeus"));
temp.setTextoGal(rs.getString("textogal"));
temp.setTextoVal(rs.getString("textoval"));
temp.setTitulo(rs.getString("titulo"));
temp.setTituloCat(rs.getString("titulocat"));
temp.setTituloEus(rs.getString("tituloeus"));
temp.setTituloGal(rs.getString("titulogal"));
temp.setTituloIng(rs.getString("tituloing"));
temp.setTituloVal(rs.getString("tituloval"));
//temp.setAnyo(rs.getString("anyo"));
//temp.setMes(rs.getString("mes"));*/
//Ahora a�ado todo al vector
System.out.println("ahora llego al vector");
vectorNoticias.addElement(temp);
// mostarNoticias(resp,idioma);
}
} catch (SQLException sql) {
System.out.println("Se ha producido un error SQL");
System.out.println(sql.getMessage());
} finally {
if (st != null) {
try {
st.close();
} catch (SQLException e) {
System.out.println("Se ha producido un error al cerrar la conexion");
System.out.println(e.getMessage());
}
}
}
}
First: I dont get in the console the variable TITULO (a String) and anyway i
get a SQL exception : "NO data found " or another one "Invalid Column number
<2>" (the TITULO column). ANy help? Thanks.
I�ll also thank you if you can tell me where can i get a good debugger (the
Visual Age debugger doesnt works with servlets cause they�re not applets or
runnable). Thanks a lot
JAvi
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html