Guest User

prog

a guest
Jan 16th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package batchddemo;
  7. import java.sql.*;
  8. /**
  9. *
  10. * @author admin
  11. */
  12. public class BatchDdemo {
  13.  
  14. /**
  15. * @param args the command line arguments
  16. */
  17. public static void main(String[] args) {
  18. // TODO code application logic here
  19. try {
  20. Class.forName("oracle.jdbc.driver.OracleDriver");
  21. Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "system");
  22. System.out.println("database connected...");
  23. Statement stmt=con.createStatement();
  24. // stmt.execute("create table t3(name varchar2(10),rollno number(6))");
  25. // System.out.println("Table created...");
  26. stmt.executeUpdate("insert into t3 values('ss',12)");
  27. System.out.println("data inserted...");
  28. } catch (ClassNotFoundException | SQLException e) {
  29. System.out.println(e);
  30. }
  31. }
  32.  
  33. }
Add Comment
Please, Sign In to add comment