Eliminar Datos Desde Java A Una Bases De Datos

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Eliminar Datos Desde Java A Una Bases De Datos as PDF for free.

More details

  • Words: 65
  • Pages: 1
import java.sql.*; public class NewClass { final static String basedatos= "jdbc:odbc:tabla1"; public static void main(String[] args) { eliminarRegistro("DELETE FROM tabla1 WHERE nombres= 'jose'"); } public static void eliminarRegistro(String sentencia) { try { Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection (basedatos); Statement sentenciaSQL = con.createStatement(); sentenciaSQL.executeUpdate(sentencia); con.close(); sentenciaSQL.close(); System.out.println("la base de datos fue actaualizada"); } catch(Exception error){ System.out.println("no se pudo actualizar base de datos: "+error); }} }

Related Documents