Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/11/2006, 19:08
Alis2320
 
Fecha de Ingreso: octubre-2006
Mensajes: 18
Antigüedad: 17 años, 7 meses
Puntos: 0
NetBeans + MYSQL + Servlet

Hola a todos como estan, tengo un gran problema, estoy tratando de insertar datos desde un formulario html, luego invoco a un servlet, estoy trabajando con Netbeans y ApacheTomCat, tengo este codigo para insertar datos a MYSQL pero al momento de enviar los datos por mi formulario me sale este error: SQL Exception: No suitable driver

Alguien sabe a que se debe, gracias de antemano.
Aqui esta el codigo:
public void IngresarDatos(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String fecha = req.getParameter("fecha");
String no_extension = req.getParameter("no_extension");
String dep_origen = req.getParameter("dep_origen");
String dep_destino = req.getParameter("dep_destino");
String no_marcado = req.getParameter("no_marcado");
String submit = req.getParameter("submit");


res.setContentType("text/html");
ServletOutputStream out = res.getOutputStream();

out.println("<HTML><HEAD><TITLE>Registros</TITLE></HEAD>");


try{
Class.forName("org.gjt.mm.mysql.Driver");
out.println("Conectado");
}catch (Exception e){
out.println("Error en el Programa");
}

String url = "jdbc:mysql://localhost/basededatos";
String username = "root";
String password = "rolling";

try{
Connection conn = DriverManager.getConnection(url,username,password) ;
Statement stmt = conn.createStatement();
int resultado = 0;
resultado = stmt.executeUpdate("Insert into registro(fecha,no_extension,dep_origen,dep_destino ,no_marcado) values('" +
fecha + "','" + no_extension + "','" + dep_origen + "','" + dep_destino + "','" + no_marcado + "')");
out.println("Registro Insertado");
out.println(resultado);
conn.close();
stmt.close();

}catch (SQLException e){
out.println("Error en select" + e + "<BR>");
}

out.println("</BODY></HTML>");


}