Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public static void main(String[] args) {
  2. Properties prop = new Properties();
  3. FileInputStream propFile = new FileInputStream("C:/Users/leanovia/workspace-jboss/fatec/src/my.properties");
  4. prop.load(propFile);
  5. String myRequest = prop.getProperty("my.request");
  6. System.out.println(myRequest);
  7. try{
  8. Class.forName("oracle.jdbc.OracleDriver");
  9. Connection myConnection = DriverManager.getConnection("jdbc:oracle:thin:@//10.192.69.2:1521/TSTLEASE.PROD", "autoself", "autoself");
  10. Statement mySatement = myConnection.createStatement();
  11. System.out.println("Timeout: " + mySatement.getQueryTimeout());
  12. ResultSet myResult = mySatement.executeQuery(myRequest);
  13. while(myResult.next()){
  14. System.out.print("===== : ");
  15. System.out.println(myResult.getString(1));
  16. }
  17. }catch (Exception e){
  18. e.printStackTrace(System.out);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement