public Nhs() { oplog = OperLog.instance; sb = new StringBuilder(); dbconf = OraConf.instance.DBs[0]; //file = nhsfile; }
private void button1_Click(object sender, EventArgs e) { OracleDatabase db = null; string constring = "user id=hs_fund;password=handsome;data source=devgh"; OperLog oplog = OperLog.instance; try { // Create an instance of an OracleDatbase object db = new OracleDatabase(constring); // Start up the database //db.Startup(); Console.WriteLine("The Oracle database is now up."); // Executing Startup() is the same as the following: // db.Startup(OracleDBStartupMode.NoRestriction, null, true); // which is also the same as: // db.Startup(OracleDBStartupMode.NoRestriction, null, false); db.ExecuteNonQuery(""); // db.ExecuteNonQuery("ALTER DATABASE OPEN"); } catch (OracleException ex) { string err = "连接Oracle数据库失败,TNSNAME:racle异常信息:" + ex.Message; oplog.WriteLog(err, LogLevel.Error); System.Windows.Forms.MessageBox.Show(err); } catch (Exception ex) { string err = "连接Oracle数据库失败,TNSNAME:异常信息:" + ex.Message; oplog.WriteLog(err, LogLevel.Error); System.Windows.Forms.MessageBox.Show(err); } finally { // Dispose the OracleDatabase object db.Dispose(); } }
private OraConf() { log = OperLog.instance; DBs = new List<DBConf>(); // 加载配置文件 LoadConf(); }