• 使用 Oracle Data Access Components连接oracel


    使用微软自带的oracle连接类,在framework4.0中被标识为弃用,强行用它开发了Winform程序,发布放到XP上提示:

    Error System.Data.OracleClient requires Oracle client software version 8.1.7 or greater when installs setup

    最后还是换成Oracle的组件解决,记录一下步骤

    1, http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html

       选择

    2, http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html

     下载:ODP.NET_Managed_ODAC12cR4.zip - 2.57 MB

    3,解压并在dos运行命令

     install_odpm.bat c:oracle x64 false

    4, 在项目中找到添加引用

       C:oracleodp.netmanagedcommonOracle.ManagedDataAccess.dll

    5, Happy Coding

      

    using Oracle.ManagedDataAccess.Client;
    
    
    namespace Util
    {
        public class OracleManager : IDBManager
        {
            private const string CONNECT_STRING = "Data Source = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS =(PROTOCOL = TCP)(HOST = {0})(PORT = {1})))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = {2}))); User Id = {3}; Password = {4}";
    
            public string GetConnectString(string dbName, string IP, string user, string pwd, string port)
            {
                return String.Format(CONNECT_STRING, IP, port, dbName, user, pwd);
            }
    
            public DbConnection GetConnection(string connectionString)
            {
                return new OracleConnection(connectionString); 
            }


    签名:删除冗余的代码最开心,找不到删除的代码最痛苦!
  • 相关阅读:
    PAT顶级 1024 Currency Exchange Centers (35分)(最小生成树)
    Codeforces 1282B2 K for the Price of One (Hard Version)
    1023 Have Fun with Numbers (20)
    1005 Spell It Right (20)
    1092 To Buy or Not to Buy (20)
    1118 Birds in Forest (25)
    1130 Infix Expression (25)
    1085 Perfect Sequence (25)
    1109 Group Photo (25)
    1073 Scientific Notation (20)
  • 原文地址:https://www.cnblogs.com/season2009/p/6077789.html
Copyright © 2020-2023  润新知