locked
Problem in connection to oracle database. RRS feed

  • Question

  • User-163012697 posted

    I am trying to connect the oracle database, it is connected through win form application but , using same connection string it is not connected through website or web application?

    Please let me know the reason behind this , trying to sorting out problem but unable to resolve it.

    Connection String:   Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.XXX)(PORT = 1521))) (CONNECT_DATA =(SERVICE_NAME = XXXX)));User ID=XXXX;Password=XXXX;

    Throws:  Error 

    ORA-06413: Connection not open.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Data.OracleClient.OracleException: ORA-06413: Connection not open.


    Source Error: 

    Line 32:         catch (Exception ex)
    Line 33:         {
    Line 34:             throw;
    Line 35:         }
    Line 36: 


    Source File: c:\Users\dcadmin\Documents\Visual Studio 2010\WebSites\WebSite1\App_Code\DBConnection.cs    Line: 34 

    Stack Trace: 

    [OracleException (0x80131938): ORA-06413: Connection not open.
    ]
       System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle, Int32 rc) +338904
       System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +879
       System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) +129
       System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +40
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +548
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +69
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +470
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +118
       System.Data.OracleClient.OracleConnection.Open() +43
       DBConnection.OpenConnection() in c:\Users\dcadmin\Documents\Visual Studio 2010\WebSites\WebSite1\App_Code\DBConnection.cs:34
       _Default.Page_Load(Object sender, EventArgs e) in c:\Users\dcadmin\Documents\Visual Studio 2010\WebSites\WebSite1\Default.aspx.cs:17
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
       System.Web.UI.Control.OnLoad(EventArgs e) +92
       System.Web.UI.Control.LoadRecursive() +54
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
    

     


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34209

    Saturday, September 5, 2015 8:40 AM

Answers

  • User-163012697 posted

    Hi Thanks all for your kind support.........

      It is resolved now . I just installed Oracle Client 11g  R2 instead of 10g .... and the connection succeeded.    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 21, 2015 4:24 AM

All replies

  • User-163012697 posted

    Has any one got the solution. Please let me know.

    Sunday, September 6, 2015 4:49 AM
  • User614698185 posted

    Hi jjbhatt_asp,

    System.Data.OracleClient.OracleException: ORA-06413: Connection not open.

    Based on your error, I think your project in the DLL Windows Path are not supported. You'll need to install Oracle binaries in another location that do not contain these characters in the directory name.

    For more information about this error, please refer to the following documents:

    http://blogs.msdn.com/b/debarchan/archive/2009/02/04/good-old-connectivity-issue.aspx 

    Best Regards,

    Candice Zhou

    Monday, September 7, 2015 5:03 AM
  • User-163012697 posted

    Thanks Candice,

               Now I had totally re-installed Every thing including  VS 2010 Professonal with SP1 setup.

    • Windows 7 64-bit 
    • Oracle Database: 10 g 10.2.0.4 64 bit
    • Oracle Client 11gR2 for Win(x64)
    • Visual Studio Professional 2010 with SP1
    • I am connecting through tnsnames. And yes through Oracle SQL Developer it is connected.
    • But when i run through VS it throws error.

    webconfig:

    <add name="dbOraConn" connectionString="Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.x.xxx)(PORT = 1521))) (CONNECT_DATA =(SERVICE_NAME = xxxxx)));User ID=xxxxxx;Password=xxxxxx;"/>

    Code behind:

    using (OracleConnection con = new OracleConnection(ConfigurationManager.ConnectionStrings["dbOraConn"].ConnectionString))
                {
                    try
                    {
                       
                            con.Open();
                       
                        
                    }
                    catch (Exception ext)
                    {
    
                    }
                }

    Error:   Attempt to load Oracle client libraries threw BadImageFormatException.  This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

    Please let me know.

    Monday, September 7, 2015 10:20 AM
  • User614698185 posted

    Hi jjbhatt_asp,

    Error:   Attempt to load Oracle client libraries threw BadImageFormatException.  This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

    Based on your error, one solution is to install both x86 (32-bit) and x64 Oracle Clients on your machine, then it does not matter on which architecture your application is running.

    I think you could refer to the following links:

    http://stackoverflow.com/questions/24104210/badimageformatexception-this-will-occur-when-running-in-64-bit-mode-with-the-32

    http://stackoverflow.com/questions/5869969/badimageformatexception-while-using-oracle-client-64-bit-and-visual-studio-2010

    I hope this will help you.
    Best Regards,
    Candice Zhou

    Wednesday, September 9, 2015 4:28 AM
  • User632428103 posted

    Hello,

    where i work now , we work with ms sql server but before i work with oracle 10 g xe (free version)

    make sur, you've install on your machine odp net => oracle database provider

    follow this article and good luck

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/hol08/dotnet/getstarted-c/getstarted_c_otn.htm

    hope this help

    Wednesday, September 9, 2015 4:35 AM
  • User-163012697 posted

    Hi jimmy ,

    Thanks I too thought but one of the guy told me that ODP.NET typical configuration is already configured while installing the setup of Oracle Client 10g 32 bit.

    Friday, September 18, 2015 10:41 PM
  • User632428103 posted

    Hello,

    follow the link i've submit last week and try the sample ..

    as i said, now unhappy i don't work with oracle ..

    have a nice day

    Monday, September 21, 2015 2:59 AM
  • User-163012697 posted

    Hi Thanks all for your kind support.........

      It is resolved now . I just installed Oracle Client 11g  R2 instead of 10g .... and the connection succeeded.    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 21, 2015 4:24 AM