Servidor mysql não grava dados

1 resposta
M

tenho o seguinte codigo e conecta normal me da a mensagem que os dados foram gravados entretanto qdo vou ver…nada gravado no mysql…Alguem pode me dar um help…

<%--
    Document   : formInserindoDados
    Created on : 13/08/2010, 08:08:01
    Author     : Carlos
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Inserindo Dados via JFBC com JSP</title>
    </head>
    <body>
        <form action="inserindoDados.jsp" method="post">
            <table>
                <tr>
                    <td>Processo:</td>
                    <td><input type="text" name="processo" /></td>
                </tr>
                <tr>
                    <td>Empresa:</td>
                    <td><input type="text" name="empresa" /></td>
                </tr>
                <tr>
                    <td>Pasta:</td>
                    <td><input type="text" name="pasta" /></td>
                </tr>
                <tr>
                    <td>Vara:</td>
                    <td><input type="text" name="vara" /></td>
                </tr>
                <tr>
                    <td>Parte1:</td>
                    <td><input type="text" name="parte1" /></td>
                </tr>
                <tr>
                    <td>cpf1:</td>
                    <td><input type="text" name="cpf1" /></td>
                </tr>
                <tr>
                    <td>Parte2:</td>
                    <td><input type="text" name="cpf2" /></td>
                </tr>
                <tr>
                    <td>cpf2:</td>
                    <td><input type="text" name="cpf2" /></td>
                </tr>
                <tr>
                    <td>CDA:</td>
                    <td><input type="text" name="cda" /></td>
                </tr>
                <tr>
                    <td>Andamento:</td>
                    <td><textarea name="descricao" rows="5" cols="25"></textarea></td>
                </tr>
                <tr>
                    <td>Ano:</td>
                    <td><input type="text" name="ano" /></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" name="btCadastrar" value="Enviar" />
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>
<%--
    Document   : inserindoDados
    Created on : 13/08/2010, 08:22:04
    Author     : Carlos
--%>

<%@page language="java" contentType="text/html" pageEncoding="ISO-8859-1" import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%
String processo = request.getParameter("processo");
String empresa = request.getParameter("empresa");
String pasta = request.getParameter("pasta");
String vara = request.getParameter("vara");
String parte1 = request.getParameter("parte1");
String cpf1 = request.getParameter("cpf1");
String parte2 = request.getParameter("parte2");
String cpf2 = request.getParameter("cpf2");
String cda = request.getParameter("cda");
String andamento = request.getParameter("andamento");
String ano = request.getParameter("ano");

Connection conn = null;
PreparedStatement pst = null;

try {
    Class.forName("com.mysql.jdbc.Driver").newInstance( );
    conn = DriverManager.getConnection("jdbc:mysql://localhost/ad","root","virtual");

    String SQL = "INSERT INTO controle (processo, empresa, pasta, vara, parte1, cpf1, parte2, cpf2, cda, andamento, ano)"+"values (?,?,?,?,?,?,?,?,?,?,?)";

    pst = conn.prepareStatement(SQL);

    pst.setString(1, processo);
    pst.setString(2, empresa);
    pst.setInt(3, Integer.parseInt(pasta));
    pst.setString(4, vara);
    pst.setString(5, parte1);
    pst.setInt(6, Integer.parseInt(cpf1));
    pst.setString(7, parte2);
    pst.setInt(8, Integer.parseInt(cpf2));
    pst.setInt(9, Integer.parseInt(cda));
    pst.setString(10, andamento);
    pst.setString(11, ano);


    pst.executeUpdate( );
    pst.clearParameters( );

    } catch (Exception ex) {
        ex.printStackTrace( );
        } finally {
            if( pst != null) pst.close( );
            if(conn != null) conn.close( );
            }
        %>
        <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>DadosRecebidos</title>
    </head>
    <body>
        <h1>O Processo <strong><%=processo %></strong>foi inserido com sucesso!</h1>
    </body>
</html>

1 Resposta

M

já encontrei o erro…obrigado

Criado 18 de agosto de 2010
Ultima resposta 18 de ago. de 2010
Respostas 1
Participantes 1