JSP (Java Server Page) - DB

 
Vista:

DB

Publicado por Tosto (2 intervenciones) el 12/05/2006 19:37:44
Slaudos a todos,

estoy tratando de cargar una tabla desde mysql, este es el codigo:

<div id="right_col">
<a href="noticias.jsp"><img src="../_img/img_noticias.png" /></a>
<table width="200" border="1">
<%
Connection canal = null;

ResultSet rsFecha= null;
ResultSet rsTitulo= null;
ResultSet rsIntro= null;

Statement instruccion=null;

String strcon = "jdbc:mysql://localhost/mipp_db?user=root&password=admin";

// abriendo canal o enlace en su propio try-catch

try {

Class.forName("com.mysql.jdbc.Driver").newInstance();

canal=DriverManager.getConnection(strcon);

instruccion = canal.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,

ResultSet.CONCUR_UPDATABLE);

} catch(java.lang.ClassNotFoundException e){} catch(SQLException e) {};

String q_1 = "select fecha from news";
String q_2 = "select titulo from news";
String q_3 = "select introduccion from news";
try {
rsFecha = instruccion.executeQuery(q_1);
rsFecha.next();

rsTitulo = instruccion.executeQuery(q_2);
rsTitulo.next();

rsIntro = instruccion.executeQuery(q_3);
rsIntro.next();
%>
<tr>
<td>
<h1><% out.println(rsFecha.getString(1)); %></h1>
<h2><% out.println(rsTitulo.getString(1)); %></h2>
<p><% out.println(rsIntro.getString(1)); %></p>
<a class="more" href="#" >»Mas...</a>
</td>
</tr>
<%
rsFecha.close();
rsTitulo.close();
rsIntro.close();
instruccion.close();
canal.close();

} catch(SQLException e) {} catch(Exception ex){};

%>
</table>
</div><!-- End #right_col -->

el problema es que cuando lo corro no me despliega la tabla.

Podria alguien hacerme alguna sugerencia
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder