Skip to content

Instantly share code, notes, and snippets.

@leanhboi1999
Created May 16, 2019 14:32
Show Gist options
  • Save leanhboi1999/de943158c78ab5deb97c33b0cf2d0c0a to your computer and use it in GitHub Desktop.
Save leanhboi1999/de943158c78ab5deb97c33b0cf2d0c0a to your computer and use it in GitHub Desktop.
package learn;
import java.sql.Connection;
import java.sql.DriverManager;
public class OracleConnection {
public static void main(String[] args) {
try {
String strConn="jdbc:oracle:thin:@localhost:1521/orcl";
Connection conn=DriverManager.getConnection(strConn,"QLTV","123456");
//Link + user + password
if(conn!=null) {
System.out.println("Kết nối thành công");
}
else {
System.out.println("Kết nối thất bại");
}
} catch (Exception e) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment