// 连接字符串格式:User Id=[用户名];Password=[密码];Data Source=[主机名]:[端口]/[DB 服务名];
OracleConnection con = new OracleConnection("User Id=system;Password=GetStarted18c;Data
Source=localhost:1521/XEPDB1;");
con.Open();
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "SELECT \'Hello World!\' FROM dual";
OracleDataReader reader = cmd.ExecuteReader();
reader.Read();
Console.WriteLine(reader.GetString(0));
C# / .NET连接 Oracle数据库
于 2023-03-05 00:21:10 首次发布