Advertisement
Guest User

oracle connection

a guest
Feb 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.SQLException;
  4.  
  5. public class Ex1 {
  6.  
  7. public static void main(String[] args) throws ClassNotFoundException, SQLException {
  8. Class.forName("oracle.jdbc.driver.OracleDriver");
  9. String url="jdbc:oracle:thin:\"mvoronin\"/13091994@192.168.22.60:1521:orcl2";
  10. String usr="\"mvoronin\"";
  11. String pwd="66666666";
  12. Connection co=null;
  13. //Connection co = DriverManager.getConnection(url,usr,pwd);
  14. try{
  15. co = DriverManager.getConnection(url);
  16. }catch (Exception e) {
  17. System.out.println("pas de co");
  18. }
  19. if(co!=null){
  20. System.out.println("connecté!");
  21. }
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement