Monday, February 13, 2017

Jdbc Program to update column data of 'emp' table .

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class Jdbc9
{
public static void main(String[] args)
{
// Establishing the connection
try(Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1522:xe","system","manager"))
{
// Creating statement to execute query
Statement st=con.createStatement();
// Executing Query
int rc=st.executeUpdate("update emp set sal=sal+500");
System.out.println(rc+" row updated");
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}

Share this

0 Comment to "Jdbc Program to update column data of 'emp' table ."

Post a Comment