C# connect to oracle

1. Quote Oracle.DataAccess.dll, install oracle library, the directory is D:\app\Administrator\product\11.2.0\dbhome_1\ODP.NET\bin\2.x

2. string oracleConnectionStr = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))

(CONNECT_DATA=(SERVICE_NAME=OYD)));Persist Security Info=True;User ID=OYD;Password=123456;";

HOST is the ip address; PORT port is 1521; SERVICE_NAME is the oracle user; User ID is the account; Password is the password

3. string beforeSql = "select * from \"sync_info\" where \"synced\"=0"; //Use the escape character \" to add "to identify the keyword

DataTable beforeDt = OracleHelper.Fill(oracleConnectionStr, CommandType.Text, beforeSql, null)

 

to_char(sysdate,'yyyyMMdd') //oracle gets the current time and converts it to yyyyMMdd format

Modify the table name: alter table old table name rename to new table name;

Guess you like

Origin blog.csdn.net/oYuHuaChen/article/details/114255465