Advertisement
Guest User

Untitled

a guest
Aug 10th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. public class RegisterDAO {
  2.     public static int save(){
  3.         int status = 0;
  4.         try{
  5.             Class.forName("org.postgresql.Driver");
  6.             String url = "jdbc:postgresql://127.0.0.1/mydb1?user=ehill&password=technic";
  7.             Connection con=DriverManager.getConnection(url);
  8.  
  9.             PreparedStatement ps = con.prepareStatement("insert into helloworld values(?,?,?)");
  10.  
  11.             ps.setInt(1, 25);
  12.  
  13.             try{
  14.                 Thread.sleep(1500);
  15.                 ps.setString(2, "Loopo");
  16.                 ps.setString(3, "435");
  17.  
  18.                 }
  19.                 catch (Exception e) {
  20.                     System.out.println(e);
  21.                     NewRelic.noticeError(e.getMessage()); <-------------------------------
  22.                 }
  23.  
  24.             status=ps.executeUpdate();
  25.         }
  26.         catch (Exception e){
  27.             e.printStackTrace();
  28.             NewRelic.noticeError(e.getMessage());  <------------------------
  29.         }
  30.         return status;
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement