import java.sql.*;
import java.io.*;
class actorupr
{ public static void main(String
ar[])throws Exception
{
int
ano;
String
aname,amovie;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con = DriverManager.getConnection("jdbc:odbc:dbaccess");
BufferedReader
br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("\nEnter
Actor No: ");
ano=Integer.parseInt(br.readLine());
System.out.print("\nEnter
Actor Name: ");
aname=br.readLine();
System.out.print("\nEnter
Actor Movie: ");
amovie=br.readLine();
PreparedStatement
p=con.prepareStatement("insert into actor values(?,?,?)");
p.setInt(1,ano);
p.setString(2,aname);
p.setString(3,amovie);
p.executeUpdate();
Statement
s=con.createStatement();
ResultSet
rs=s.executeQuery("select * from actor");
System.out.println("\nRESULT
IN UPPER CASE:");
while(rs.next())
{
System.out.println("\n"+rs.getInt(1)+"
"+rs.getString(2).toUpperCase()+" "+rs.getString(3).toUpperCase());
}
rs.close();
con.close();
}
}
Post a Comment