Guest User

Untitled

a guest
Apr 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. @Service
  2. public class ExecutionPlanService {
  3. List<String> l = new ArrayList<>();
  4.  
  5.  
  6. public List<String> getExecPlan(String line) throws IOException, SQLException, ClassNotFoundException{
  7. ResultSet rs=null;
  8.  
  9. Class.forName("oracle.jdbc.driver.OracleDriver");
  10.  
  11. Connection con=DriverManager.getConnection("jdbc:oracle:thin:@abc:XYZ","username","pw");
  12.  
  13. Statement stmt = con.createStatement();
  14. stmt.execute(line);
  15. rs = stmt.executeQuery("select plan_table_output from table(dbms_xplan.display())");
  16.  
  17. while (rs.next())
  18. {
  19. l.add(rs.getString(1));
  20.  
  21.  
  22. }
  23.  
  24. return l;
  25. }
Add Comment
Please, Sign In to add comment