Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- import java.util.*;
- class Conn {
- public static void main (String[] args) throws Exception
- {
- Class.forName ("oracle.jdbc.OracleDriver");
- Connection conn = DriverManager.getConnection
- ("jdbc:oracle:thin:@//oracle12c:1521/orcl", "pharmafarm", "pharmafarm");
- // @//machineName:port/SID, userid, password
- try {
- Statement ID_query = conn.createStatement();
- try {
- ResultSet ID = ID_query.executeQuery("select MAX(ID) from lada_filmezes");
- try {
- while (ID.next())
- System.out.println (ID.getString(1)); // Print colon 1
- }
- finally {
- try { ID.close(); } catch (Exception ignore) {}
- }
- }
- finally {
- try { ID_query.close(); } catch (Exception ignore) {}
- }
- }
- try {
- int new_ID = ID + 1;
- System.out.println(new_ID);
- }
- finally {
- try { conn.close(); } catch (Exception ignore) {}
- }
- }
- }
- /**public class lada_fenykepezes {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.print("Barcode:");
- String barcode = in.nextLine();
- System.out.println("The barcode is:"+ barcode);
- System.out.println(ID);
- }
- }**/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement