■ Oracle 데이터베이스를 사용하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
using System; using System.Data; using Oracle.DataAccess.Client; string serviceName = @" (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ) )"; string sql = "SELECT SYSDATE FROM DUAL"; DataSet set = new DataSet(); OracleConnection connection = new OracleConnection("Data Source=" + serviceName + ";User ID=SYSTEM;Password=1234"); connection.Open(); OracleDataAdapter OrcleAd = new OracleDataAdapter(sql, connection); connection.Close(); OrcleAd.Fill(set); Console.WriteLine(set.Tables[0].Rows[0][0].ToString()); |
※ 첨부 파일을 참조한다.