static private string GetConnectionString()
{
//return "Data Source=XE;Persist Security Info=True;User ID=test;Password=test;
Unicode=True";
//return "User Id=test;Password=test;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=
TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=XE)))";
//return "Driver=(Oracle in XEClient);dbq=192.168.252.161:1521/XE;Uid=system;Pwd=oracle;";
//return "Driver={Microsoft
ODBC for Oracle};Server=192.168.252.161;Uid=test;Pwd=test;";
//return "Provider=msdaora;Data Source=XE;User Id=test;Password=test;";
return "Persist Security Info=True;User ID=test;Password=test;"
+ "Data source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=
TCP)"
+ "(HOST=
localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=XE)))";
}
private void button1_Click(object sender, EventArgs e)
{
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OracleClient");
using (IDbConnection conn = factory.CreateConnection())
{
conn.ConnectionString = GetConnectionString();
conn.Open();
label1.Text = conn.State.ToString();
}
}