• .NET连接Oracle数据库


    <connectionStrings>
            <add name="oracle" connectionString="Data Source= (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = xxxx))) (CONNECT_DATA = (SERVICE_NAME= xxxx) ));User ID=xxxx;Password=xxxx" providerName="System.Data.OracleClient" />
        </connectionStrings>
    HOST = xxx.xxx.xxx.xxx为IP地址
    PORT = xxxx为端口

    SERVICE_NAME= xxxx为数据库名

    User ID=xxxx;Password=xxxx为数据库用户名和密码


    using Oracle.ManagedDataAccess.Client;
    /// <summary>
            /// 传入ORACLE-SQL获取SqlDataReader
            /// </summary>
            /// <param name="sql"></param>
            /// <returns>OracleDataReader</returns>
            public static OracleDataReader GetOracleReader(string sqlconn, string sql)
            {
                OracleConnection conn = new OracleConnection(sqlconn);
                conn.Open();
                OracleCommand cmd = new OracleCommand(sql, conn);
                OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                return reader;
            }

  • 相关阅读:
    ABP 异常
    Vmware中安装的Ubuntu不能全屏问题解决
    centos7.4 文件权限
    webpack 入门(1)
    webpack(2) 概念
    centos7.4 rpm命令
    centos7.4 which、whereis、locate的使用
    centos7.4 find命令
    centos7.4 lsof用法
    centos7.4 用户和组的管理
  • 原文地址:https://www.cnblogs.com/xiaoli9627/p/15069750.html
Copyright © 2020-2023  润新知