PROGRAMMING CODE/ORACLE&DB
[Oracle] VisualStudio 와 Oracle의 연결
daye_
2021. 10. 19. 20:22
[OracleConnection]
oracleConnection1부분 설정
this.oracleConnection1.ConnectionString = "~~~~~~";
this.oracleConnection1.Credential = null;
this.oracleConnection1.PDBNanme = "xepdb1";
this.oracleConnection1.ServiceName = "xepdb1";
connectionString의 물결부분에 넣어주어야 할 코드
1. with tnsnames.ora
DATA SOURCE = XEPDB1;
USER ID = daye; PASSWORD = 1234;
2. without tnsnames.ora
DATA SOURCE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST=IP)(PORT=1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XEPDB1)
)
)
USER ID = daye;
PASSWORD = 1234;
[OracleCommand]
this.oracleCommand1.CommandText = "쿼리문";
this.oracleCommand1.Connection = this.oracleConnection1;
this.oracleCommand1.Transaction = null;
command 객체의 메소드
ExecuteReader - SELECT로 결과는 Bag반환...
ExecuteNonQuery - INSERT, DELETE, UPDATE
ExecuteScalar - 단일값 반환