CLASS/DATABASE
#4-1 / Oracle sts 연결
hingu
2024. 9. 3. 12:30
👀 sts4 data Resource Explorer setting
⭐ localhost:1521/xepdb1
=> 각각의 가상 컨테이너가 작동하면서 DB가 셋팅되어있음
localhost:1521:xepdb1
=> PDB안에 xepdb1이 포함되어서 DB가 셋팅되어있음
( 하나가 죽으면 다 죽어서 실무에선 이걸 사용하지 않음 )
1. resource Explerer open
2. 일단 요렇게 하고 ping fail 떠도 finish
3.
요기 들어가서
4.
: 제거후 test 해보면 됩니당
5.
===> : 아니고 / 임 !!!
6.
//얘도 수정해야함 !! / 주의
public class dbinfo {
// ㅇㅅaㅇ
public static Connection getinfo() throws Exception {
String dbinfo = "oracle.jdbc.OracleDriver";
//String dburl = "jdbc:oracle:thin:@localhost:1521:XE";
String dburl = "jdbc:oracle:thin:@localhost:1521/xepdb1";
String dbuser = "HANA";
String dbpass = "hana1234";
Class.forName(dbinfo);
Connection con = DriverManager.getConnection(dburl,dbuser,dbpass);
return con;
}
}
driver추가할 때
a driver already exist ~~~하는 에러가 발생한다면,
Windows-Preferences-Data Management - Connectivity - Driver Definition
의 경로에서 추가하고자 했던 드라이버와 같은 이름을 갖는 것을 삭제해 주면됨