我连接orale数据库是使用连接字符串
Provider=MSDAORA.1;Password=user;User ID=user;Data Source=orasvr;Persist Security Info=True
时失败,
但是使用连接字符串
Provider=OraOLEDB.Oracle.1;Password=user;Persist Security Info=True;User ID=user;Data Source=orasvr
时就可以成功连接,这是为什么,如何解决?

解决方案 »

  1.   

    连接Provider不一样,可能你的配置不一样!
    Oracle XE 
     
    Standard 
    Oracle XE (or "Oracle Database 10g Express Edition") is a simple version that's free to distribute.  
    Driver=(Oracle in XEClient);dbq=111.21.31.99:1521/XE;Uid=myUsername;Pwd=myPassword; 
     
      COPY TO CLIPBOARD 
    ODBC 
     
    New version 
      
    Driver={Microsoft ODBC for Oracle};Server=myServerAddress;Uid=myUsername;Pwd=myPassword; 
     
      COPY TO CLIPBOARD 
    Old version 
      
    Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword; 
     
      COPY TO CLIPBOARD 
    OLE DB, OleDbConnection (.NET) 
     
    Standard security 
    This connection string uses a provider from Microsoft.  
    Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword; 
     
      COPY TO CLIPBOARD 
    Trusted connection 
      
    Provider=msdaora;Data Source=MyOracleDB;Persist Security Info=False;Integrated Security=Yes; 
     
      COPY TO CLIPBOARD 
    Standard Security 
    This connection string uses a provider from Oracle.  
    Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword; 
     
      COPY TO CLIPBOARD 
    Trusted Connection 
      
    Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1; 
     
      COPY TO CLIPBOARD 
    TNS-less connection string 
      
    Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myHost)(PORT=myPort)))(CONNECT_DATA=(SID=MyOracleSID)(SERVER=DEDICATED)));User Id=myUsername;Password=myPassword; 
     
      COPY TO CLIPBOARD 
    Oracle.DataAccess.Client.OracleConnection 
     
    Standard 
      
    Data Source=TORCL;User Id=myUsername;Password=myPassword; 
     
      COPY TO CLIPBOARD 
    Using integrated security 
      
    Data Source=TORCL;Integrated Security=SSPI; 
     
      COPY TO CLIPBOARD 
    Using ODP.NET without tnsnames.ora 
      
    Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword; 
     
      COPY TO CLIPBOARD 
    OracleConnection, Oracle Data Provider, ODP.NET, System.Data.OracleClient.OracleConnection 
     
    Standard 
      
    Data Source=MyOracleDB;Integrated Security=yes; 
     
    This one works only with Oracle 8i release 3 or later  
      COPY TO CLIPBOARD 
    Specifying username and password 
      
    Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no; 
     
    This one works only with Oracle 8i release 3 or later  
    Missing the System.Data.OracleClient namespace? Download .NET Managed Provider for Oracle >> 
    Great article! "Features of Oracle Data Provider for .NET" by Rama Mohan G. at C# Corner >> 
      COPY TO CLIPBOARD 
    Omiting tnsnames.ora 
    This is another type of Oracle connection string that doesn't rely on you to have a DSN for the connection. You create a connection string based on the format used in the tnsnames.ora file without the need to actually have one of these files on the client pc.  
    SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));uid=myUsername;pwd=myPassword; 
     
      COPY TO CLIPBOARD 
     
    Some reported problems with the one above and Visual Studio. Use the next one if you've encountered problems.  
    Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword; 
     
      COPY TO CLIPBOARD 
    Using Connection Pooling 
    The connection pooling service will create a new pool if it can't find any existing pool that exactly match the new connections connection string properties. If there is a matching pool a connection will be recycled from that pool.  
    Data Source=myOracleDB;User Id=myUsername;Password=myPassword;Min Pool Size=10;Connection Lifetime=120;Connection Timeout=60;Incr Pool Size=5;Decr Pool Size=2; 
     
      COPY TO CLIPBOARD 
    Windows Authentication 
      
    Data Source=myOracleDB;User Id=/; 
     
      COPY TO CLIPBOARD 
    Privileged Connection 
    With SYSDBA privileges  
    Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSDBA; 
     
      COPY TO CLIPBOARD 
    Privileged Connection 
    With SYSOPER privileges  
    Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSOPER; 
     
      COPY TO CLIPBOARD 
    Utilizing the Password Expiration functionality 
    First open a connection with a connection string. When the connection is opened, an error is raised because the password have expired. Catch the error and execute the OpenWithNewPassword command supplying the new password.  
    Data Source=myOracleDB;User Id=myUsername;Password=myPassword; oConn.OpenWithNewPassword(sTheNewPassword);  
     
      COPY TO CLIPBOARD 
    Proxy Authentication 
      
    Data Source=myOracleDB;User Id=myUsername;Password=myPassword;Proxy User Id=pUserId;Proxy Password=pPassword; 
     
      COPY TO CLIPBOARD 
    Core Labs OraDirect (.NET) 
     
    Standard 
      
    User ID=myUsername;Password=myPassword;Host=ora;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0; 
     
    Read more at Core Lab >> 
    And at the product page >> 
      COPY TO CLIPBOARD 
    Data Shape 
     
    MS Data Shape 
      
    Provider=MSDataShape.1;Persist Security Info=False;Data Provider=MSDAORA;Data Source=orac;User Id=myUsername;Password=myPassword;