Advertisement
Guest User

Untitled

a guest
Aug 28th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import java.sql.*;
  2. import java.util.*;
  3.  
  4. class Conn {
  5. public static void main (String[] args) throws Exception
  6. {
  7. Class.forName ("oracle.jdbc.OracleDriver");
  8.  
  9. Connection conn = DriverManager.getConnection
  10. ("jdbc:oracle:thin:@//oracle12c:1521/orcl", "pharmafarm", "pharmafarm");
  11. // @//machineName:port/SID, userid, password
  12. try {
  13. Statement ID_query = conn.createStatement();
  14. try {
  15. ResultSet ID = ID_query.executeQuery("select MAX(ID) from lada_filmezes");
  16. try {
  17. while (ID.next())
  18. System.out.println (ID.getString(1)); // Print colon 1
  19. }
  20. finally {
  21. try { ID.close(); } catch (Exception ignore) {}
  22. }
  23. }
  24. finally {
  25. try { ID_query.close(); } catch (Exception ignore) {}
  26. }
  27. }
  28. try {
  29. int new_ID = ID + 1;
  30. System.out.println(new_ID);
  31. }
  32. finally {
  33. try { conn.close(); } catch (Exception ignore) {}
  34. }
  35. }
  36. }
  37.  
  38. /**public class lada_fenykepezes {
  39.  
  40. public static void main(String[] args) {
  41. Scanner in = new Scanner(System.in);
  42. System.out.print("Barcode:");
  43. String barcode = in.nextLine();
  44.  
  45. System.out.println("The barcode is:"+ barcode);
  46. System.out.println(ID);
  47. }
  48. }**/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement