You are on page 1of 3

import java.sql.

Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

public class sqldemo20demo{

public static void main(String args[]){

try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

System.out.println("Connecting to Database");

Connection con=DriverManager.getConnection("jdbc:odbc:nespdsn");

System.out.println("Connected to Database");

String s="delete from Table1 where Price>500";

PreparedStatement st=con.prepareStatement(s);

st.executeUpdate();

con.close();

catch(Exception e){

System.out.println(e);

}
}

You might also like