public DbConnection DbConnect (){
factory =
DbProviderFactories.GetFactory("Oracle.DataAccess.Client");
ocsb = factory.CreateConnectionStringBuilder();
//接続文字列の設定
ocsb["Data Source"] = "ORCL10GR2";
ocsb["User ID"] = "Scott";
ocsb["Password"] = "Tiger";
conn = factory.CreateConnection();
conn.ConnectionString = ocsb.ConnectionString;
//環境変数を設定
Environment.SetEnvironmentVariable("ORA_DEBUG_JDWP",
"mymachine.ourdomain.com;port=8888",
EnvironmentVariableTarget.Process);
//データベース接続
conn.Open();
return conn;
} |