se que para mostrar se utiliza el executeQuery(); y para introducir dats es el executeUpdate();
mi codigo es el siguiente...
Código:
de antemano gracias... import java.sql.*;
public class MySQLtest
{
public static void main(String[] args)
{
String nombre;
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/universidad","root","");
TextIO.putln("nombre: ");
nombre = TextIO.getlnString();
// PreparedStatement pstmt = con.prepareStatement("SELECT * FROM alumnos WHERE edad >?");
PreparedStatement pstmt = con.prepareStatement("SELECT * FROM " + nombre + " WHERE edad >?");
pstmt.setInt(1,0);
ResultSet rs = pstmt.executeQuery();
TextIO.putln(" NOMBRE APELLIDO EDAD FECHA ");
while(rs.next())
TextIO.putln(" " + rs.getString(2)+ " " + rs.getString(3) + " " + rs.getInt(4) + " " + rs.getDate(5));
rs.close();
pstmt.close();
con.close();
}
catch(ClassNotFoundException ex)
{
ex.printStackTrace();
}
catch(SQLException ex)
{
ex.printStackTrace();
}
}
}

