<< Click to Display Table of Contents >>

AddItemValue

데이터베이스 연결 속성을 추가합니다.

Prototype

void AddItemValue(string ItemKey, string ItemValue)

Parameters

ItemKey

아이템 키

ItemValue

아이템 값

Reference

dbconfig.xml에 정의된 벤더 아이템의 key와 value는 모두 추가하여야 하며, 이 때 user와 password 키는 반드시 추가하여야 합니다.

Example

function DataBaseConnectionSample(){

   var con = OZCreator.GetBuiltInObject(OZBuiltInObject.DBCONNECTION);

   con.SetVendor("mssql");

   con.AddItemValue("serverAddress","127.0.0.1");

   con.AddItemValue("portNo","1433");

   con.AddItemValue("dbName", "oz");

   con.AddItemValue("user", "sa");

   con.AddItemValue("password", "forcs");

   var isOK = con.Connect(false);

   _DEBUG("isOK="+isOK);

   con.SetAutoCommit(false);

   var stmt;

   try {

       stmt = con.CreateStatement();

       var query = "insert into table1 (field1) values("value1")";

       stmt.ExecuteUpdate(query);

       con.Commit();

   } catch(e) {

       con.Rollback();

       _ERROR("error="+e);

   } finally {

       stmt.Close();

       con.Close();

   }

   _DEBUG("OK");

}