本文共 4280 字,大约阅读时间需要 14 分钟。
// ODBC DSN using System.Data.Odbc; OdbcConnection conn = new OdbcConnection(); conn.ConnectionString = "Dsn=DsnName;" + "Uid=UserName;" + "Pwd=Secret;"; conn.Open();
// ODBC -- New Microsoft Driver using System.Data.Odbc; OdbcConnection conn = new OdbcConnection(); conn.ConnectionString = "Driver={Microsoft ODBC for Oracle};" + "Server=OracleServer.world;" + "Uid=UserName;" + "Pwd=Secret;"; conn.Open();
// ODBC -- Old Microsoft Driver using System.Data.Odbc; OdbcConnection conn = new OdbcConnection(); conn.ConnectionString = "Driver={Microsoft ODBC Driver for Oracle};" + "ConnectString=OracleServer.world;" + "Uid=UserName;" + "Pwd=Secret;"; conn.Open();
// ODBC -- Oracle Driver using System.Data.Odbc; OdbcConnection conn = new OdbcConnection(); conn.ConnectionString = "Driver={Oracle ODBC Driver};" + "Dbq=myDataBase;" + // define in tsnames.ora "Uid=UserName;" + "Pwd=Secret;"; conn.Open();
// OleDb -- Microsoft Driver using System.Data.OleDb; OleDbConnection conn = new OleDbConnection(); conn.ConnectionString = "Driver=MSDAORA;" + "Data Source=ServerName;" + "User id=UserName;" + "Password=Secret;"; conn.Open();
// OleDb -- Oracle Driver -- Standard Connection using System.Data.OleDb; OleDbConnection conn = new OleDbConnection(); conn.ConnectionString = "Driver=OraOLEDB.Oracle;" + "Data Source=ServerName;" + "User id=UserName;" + "Password=Secret;"; conn.Open();
// OleDb -- Oracle Driver -- Trusted Connection using System.Data.OleDb; OleDbConnection conn = new OleDbConnection(); conn.ConnectionString = "Driver=OraOLEDB.Oracle;" + "Data Source=ServerName;" + "OSAuthent=1;"; conn.Open(); // or using System.Data.OleDb; OleDbConnection conn = new OleDbConnection(); conn.ConnectionString = "Driver=OraOLEDB.Oracle;" + "Data Source=ServerName;" + "User id=/" + "Password=;"; conn.Open();
// .NET DataProvider from Microsoft // -- Standard Connection using System.Data.OracleClient; OracleConnection conn = new OracleConnection(); conn.ConnectionString = "Data Source=ServerName;" + "User id=UserName;"; "Password=Secret;"; conn.Open();
// .NET DataProvider from Microsoft // -- Trusted Connection using System.Data.OracleClient; OracleConnection conn = new OracleConnection(); conn.ConnectionString = "Data Source=Servername;" + "Integrated Security=Yes;"; conn.Open();
// .NET DataProvider from Oracle // -- Standard Connection using Oracle.DataAccess.Client; OracleConnection conn = new OracleConnection(); conn.ConnectionString = "Data Source=ServerName;" + "User id=UserName;"; "Password=Secret;"; conn.Open();
// .NET DataProvider from Oracle // -- Trusted Connection using Oracle.DataAccess.Client; OracleConnection conn = new OracleConnection(); conn.ConnectionString = "Data Source=Servername;" + "Integrated Security=Yes;"; conn.Open();
转载地址:http://gotqj.baihongyu.com/