제목 | [팁] Oracle + mysql 동시사용 | ||
---|---|---|---|
글쓴이 | ci세상 | 작성시각 | 2009/11/18 11:58:57 |
|
|||
$active_group = "mysql"; $active_record = TRUE; $db['mysql']['hostname'] = "localhost"; $db['mysql']['username'] = "root"; $db['mysql']['password'] = "apmsetup"; $db['mysql']['database'] = "cidb"; $db['mysql']['dbdriver'] = "mysql"; $db['mysql']['dbprefix'] = ""; $db['mysql']['pconnect'] = TRUE; $db['mysql']['db_debug'] = TRUE; $db['mysql']['cache_on'] = FALSE; $db['mysql']['cachedir'] = ""; $db['mysql']['char_set'] = "utf8"; $db['mysql']['dbcollat'] = "utf8_general_ci"; $dbhost = "localhost"; //IP of my host database $dbport = "1521"; //Oracle port $dbname= "ORCL"; //My database Name $dbConnString = " (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ".$dbhost.")(PORT = ".$dbport.")) ) (CONNECT_DATA = (SID = ORCL) (SERVICE_NAME = ".$dbname.") ))"; $db['oracle']['hostname'] = $dbConnString; $db['oracle']['username'] = "combort"; $db['oracle']['password'] = "1234"; $db['oracle']['database'] = ""; $db['oracle']['dbdriver'] = "oci8"; $db['oracle']['dbprefix'] = ""; $db['oracle']['pconnect'] = TRUE; $db['oracle']['db_debug'] = TRUE; $db['oracle']['cache_on'] = FALSE; $db['oracle']['cachedir'] = ""; $db['oracle']['char_set'] = "utf8"; $db['oracle']['dbcollat'] = "utf8_general_ci"; ##### codeigniter > 컨트롤 사용예제 ######## <?php class Welcome extends Controller { function Welcome() { parent::Controller(); $this->load->dbforge(); $this->DB1 = $this->load->database('mysql', TRUE); $this->DB2 = $this->load->database('oracle', TRUE); } function index() { echo "mysql or oracle Test"; } function mysql_select() { $query = $this->DB1->query("select * from board"); foreach ($query->result_array() as $row) { echo $row['title']; } echo "출력"; } function mysql_insert() { $this->DB1->query("insert into board(title, memo) values('3','test')"); } function oracle_select() { $query = $this->DB2->query("select C_NAME from customer"); foreach ($query->result_array() as $row) { echo $row['C_NAME']; } echo "출력"; } function oracle_insert() { $this->DB2->query("insert into customer(C_NO, C_NAME, C_ADDR, C_PHONE, C_DIST) values('3','test','test','1234','11')"); } }
|
|||
첨부파일 |
mysql_oracle.zip (386.9 KB) |
||
다음글 | [응용] csv 파일 읽기 (2가지방법) (2) | ||
이전글 | [팁] parse error 체크하여 시스템다운 대비하... (1) | ||
없음 |