Package com.mysql.jdbc

Examples of com.mysql.jdbc.Connection.createStatement()


    Connection con;
    try {
      con = JDBCConnection.getConexion();
      String sqlStm = "update cuenta set saldo = " + cta.getSaldo()
          + " where idCuenta = " + cta.getIdCuenta();
      java.sql.Statement sqlSta = con.createStatement();
      sqlSta.executeUpdate(sqlStm);

      // si la cuenta tiene movimientos nuevos los ingresa tambien a la
      // base de datos
View Full Code Here


    Connection con;
    try {
      con = JDBCConnection.getConexion();
      String orden = "SELECT * FROM cuenta c " + "WHERE c.idCuenta = "
          + codigo;
      java.sql.Statement sentencia = con.createStatement();
      ResultSet rs = sentencia.executeQuery(orden);
      System.out.println("ejecuto query de cuenta");
      Cuenta cuenta = null;
      int idCliente = -1;
      while (rs.next()) {
View Full Code Here

      String orden = "INSERT INTO movimientoscuenta"
          + " (Cuenta_idCuenta, tipoMovimiento, valorMovimiento, fechaMovimiento) VALUES ("
          + +cta.getIdCuenta() + ", " + mc.getTipoMvto() + ", "
          + mc.getValorMvto() + ",'" + mc.getFechaMvto() + "')";
      System.out.println("comando para ejecutar " + orden);
      java.sql.Statement sentencia = con.createStatement();
      int numFilas = sentencia.executeUpdate(orden);
      sentencia.close();
    } catch (Exception ex) {
      Logger.getLogger(CuentaDAO.class.getName()).log(Level.SEVERE, null,
          ex);
View Full Code Here

    Connection con;
    try {
      con = JDBCConnection.getConexion();
      String sqlStm = "update cuenta set saldo = " + cta.getSaldo()
          + " where idCuenta = " + cta.getIdCuenta();
      java.sql.Statement sqlSta = con.createStatement();
      sqlSta.executeUpdate(sqlStm);

      // si la cuenta tiene movimientos nuevos los ingresa tambien a la
      // base de datos
View Full Code Here

    Connection con;
    try {
      con = JDBCConnection.getConexion();
      String orden = "SELECT * FROM cuenta c " + "WHERE c.idCuenta = "
          + codigo;
      java.sql.Statement sentencia = con.createStatement();
      ResultSet rs = sentencia.executeQuery(orden);
      System.out.println("ejecuto query de cuenta");
      Cuenta cuenta = null;
      int idCliente = -1;
      while (rs.next()) {
View Full Code Here

      String orden = "INSERT INTO movimientoscuenta"
          + " (Cuenta_idCuenta, tipoMovimiento, valorMovimiento, fechaMovimiento) VALUES ("
          + +cta.getIdCuenta() + ", " + mc.getTipoMvto() + ", "
          + mc.getValorMvto() + ",'" + mc.getFechaMvto() + "')";
      System.out.println("comando para ejecutar " + orden);
      java.sql.Statement sentencia = con.createStatement();
      int numFilas = sentencia.executeUpdate(orden);
      sentencia.close();
    } catch (Exception ex) {
      Logger.getLogger(CuentaDAO.class.getName()).log(Level.SEVERE, null,
          ex);
View Full Code Here

    try {
      Connection con = JDBCConnection.getConexion();
      // // Si la condición es null o vacia, no hay parte WHERE
      String orden = "SELECT * FROM cliente cl "
          + "WHERE cl.idcliente = " + codigo;
      java.sql.Statement sentencia = con.createStatement();
      ResultSet rs = sentencia.executeQuery(orden);
      Cliente cliente = null;
      while (rs.next()) {
        cliente = new Cliente();
        cliente.setIdCliente(rs.getInt("idcliente"));
View Full Code Here

    }

    public List getPipeLineListByObjectInspectionId(Integer id, Properties props) throws SQLException {

        Connection dbConn = getConnection(props);
        Statement st = (Statement) dbConn.createStatement();
        ResultSet rs = (ResultSet) st.executeQuery("select * from pipeLineElement where objectId=" + id);
        List plList = setValues(rs);
        rs.close();
        return plList;

View Full Code Here

    public List getPipeLineListByObjectInspectionAndDetailType(Integer typeId, Integer objectId, Properties props) throws SQLException {


        Connection dbConn = getConnection(props);
        Statement st = (Statement) dbConn.createStatement();
        ResultSet rs = (ResultSet) st.executeQuery("select * from pipeLineElement where objectId=" + objectId + " and detailTypeId=" + typeId);
        List plList = setValues(rs);
        rs.close();

        return plList;
View Full Code Here

    public List getPipeLineElementDefectByPipeLineElement(Integer id, Properties properties) {
        Connection connection = getConnection(properties);
        List list = new ArrayList();
        try {
            ResultSet resultSet = connection.createStatement().executeQuery("select * from pipelineelementdefect where idElement=" + id);

            while (resultSet.next()) {
                PipeLineElementDefect pipeLineElementDefect = new PipeLineElementDefect();
                pipeLineElementDefect.setDefectId((Integer) resultSet.getInt(1));
                pipeLineElementDefect.setDefectType(defectTypeDao.getDefectType((Integer) resultSet.getInt(2)));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.