/**
 * @file: Practica_9_1.java
 * 
 * @utor: Moisés Alcocer, 2016
 */

package practicas;

//imports
import java.sql.*;

/**
 * This class ...
 * 
 */
public class Practica_9_1 {

    /**********************************/
    /*** Properties declaration *******/

    
    /**********************************/
    /*** Methods declaration **********/
        
        /**
         * Construct
         * 
         */
        public Practica_9_1() {
            System.out.println( "Practica_9_1 -> PreparedStatement" );

            String sql = "INSERT INTO departamentos"//( dept_no, dnombre, loc )
                //+ " VALUES( ?, ?, ? )";
                + " VALUES(?,\'?\',\'?\')";
            System.out.println( "SQL -> " + sql );


            System.out.println( "Obtener conexión..." );
            Connection con = universal.GetConnection.get( "mysql", mysql.DbConstants.DB_NAME );

            try {
                
                System.out.println( "Creando PreparedStatement..." );
                try ( PreparedStatement pst = con.prepareStatement( sql )) {
                    
                    System.out.println( "Cargando parámetros..." );
                    pst.setInt(    1, 70 );
                    pst.setString( 2, "BIO" );
                    pst.setString( 3, "DESPA1" );
                    
                    System.out.println( "Introducidos parámetros..." );
                    System.out.println( "Ejecuta sentencia recogiendo filas afectatas..." );
                    
                    int rows = pst.executeUpdate( sql );
                    
                    System.out.println( "Filas afectatas: " + rows );

                    //Cerrar PreparedStatement
                    System.out.println( "Cerrando PreparedStatement..." );
                    pst.close();
                }

                //Cerrar conexión
                System.out.println( "Cerrando conexión..." );
                con.close();

            } catch ( SQLException e ) {

                System.out.println( "Error ---> " + e.toString( ));
            }
        }

} //class

@@ -642,18 +642,16 @@
         
-//
 + %22 VALU
@@ -675,32 +675,34 @@
                 
+//
 + %22 VALUES(?,%5C'?
@@ -712,16 +712,47 @@
 %5C'?%5C')%22;
+ //err -%3E avoid quotation marks
 %0D%0A      
@@ -1639,21 +1639,16 @@
 eUpdate(
- sql 
 );%0D%0A    

Fix bug with "executeUpdate()" sentence