DBメモ

Oracle10g接続文字列生成のメモ

/// <summary>
/// 初期化
/// </summary>
private void Init()
{
//接続情報
this.user = "hoge";
this.password = "pass";
this.host = "192.168.10.110";
this.protocol = "TCP";
this.portNo = "1521";
this.serviceName = "ORCL";

//接続文字列取得
this.connectionString = this.GetConnectionString();
}

/// <summary>
/// 接続文字列取得
/// </summary>
/// <returns>接続文字列</returns>
private string GetConnectionString()
{
//tnsname.oraを使用しない接続
StringBuilder sb = new StringBuilder();

sb.Append(string.Format("User Id={0}; Password={1};",this.user,this.password));
sb.Append("Data Source=(DESCRIPTION = (ADDRESS_LIST = ");
sb.Append(string.Format("(ADDRESS = (PROTOCOL = {0})(HOST = {1})",this.protocol,this.host));
sb.Append(string.Format("(PORT = {0})))(CONNECT_DATA = (SERVER = DEDICATED)",this.portNo));
sb.Append(string.Format("(SERVICE_NAME = {0})));",this.serviceName));

return sb.ToString();
}


MySQL 5.1.32インストール

PHPPEAR::DBを使用するために、MySQL 5.1.32、GUIツールをインストール