Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3.  
  4. public class InsertUsers {
  5.  
  6.     public InsertUsers() {
  7.     }
  8.  
  9.     public static void main(String args[]) {
  10.  
  11.  
  12.         String url = "jdbc:oracle:thin:@localhost:1521:xe";
  13.  
  14.  
  15.         Connection con;
  16.         Statement stmt;
  17.         String query = "select COF_NAME, PRICE from COFFEES";
  18.  
  19.         try {
  20.                 Class.forName("oracle.jdbc.driver.OracleDriver");
  21.  
  22.  
  23.         } catch(java.lang.ClassNotFoundException e) {
  24.             System.err.print("ClassNotFoundException: ");
  25.             System.err.println(e.getMessage());
  26.         }
  27.  
  28.         try {
  29.  
  30.             con = DriverManager.getConnection(url,"system","4rfv5tgb&YHN");
  31.             con.close();
  32.  
  33.         } catch(SQLException ex) {
  34.             System.err.println("SQLException: " + ex.getMessage());
  35.         }
  36.  
  37.     }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement