locked
Oracle XE Connection in web.config RRS feed

  • Question

  • User507956310 posted

     Hi Guys,

    I set up my oracle xe and asp.net 2.0 and all starts apart from the connection to the
    database:


    tnsnames.ora
    XE =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = mypc)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = XE)
        )
      )

    connectionstring:


        <add name="ControlEnvironmentConnString" connectionString="Data Source=Data Source=localhost;Initial Catalog=XE;User Id=myuser;Password=myuser"  providerName="System.Data.SqlClient" />

    "Keyword not supported "Initial Catalog"

    or


        <add name="ControlEnvironmentConnString" connectionString="Data Source=Data Source=localhost;Initial Catalog=XE;User Id=myuser;Password=myuser"  providerName="System.Data.SqlClient" />

    "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"

     

    What am I doing wrong with my connection string?

    Thursday, June 11, 2009 5:19 AM

Answers

  • User364663285 posted

    See this
      <connectionStrings>
        <add name="OracleConnectionString"
     connectionString="Data Source=XE;Persist Security Info=True;User Id=...;Password=..." providerName="System.Data.OracleClient" />
      </connectionStrings>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 11, 2009 10:22 PM

All replies

  • User507956310 posted

     It does not seem to work with that either:

    connectionString="Provider=OraOLEDB.Oracle;Data Source=XE;User ID=myuser;Password=myuser"


    "Invalid .NET Data Provider specification: "

    Thursday, June 11, 2009 5:34 AM
  • User-563238995 posted

    Your connection string represents a MSSQL database. Try this,

    Provider=XE;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;
    Reference: http://www.codeproject.com/KB/cs/Oracle_XE_with_C_.aspx 
    Thursday, June 11, 2009 7:38 PM
  • User364663285 posted

    See this
      <connectionStrings>
        <add name="OracleConnectionString"
     connectionString="Data Source=XE;Persist Security Info=True;User Id=...;Password=..." providerName="System.Data.OracleClient" />
      </connectionStrings>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 11, 2009 10:22 PM
  • User507956310 posted

     Hi Stew,

    if I use you version i get "Invalid .NET Data Provider specification: "

    HuaMin, I tried you solution as well and it got to:

    ORA-01036: illegal variable name/number

    Friday, June 12, 2009 4:28 AM
  • User364663285 posted

    It should be from your codes. Can you pls provide with more details?

    Friday, June 12, 2009 4:32 AM
  • User507956310 posted

     hi wmec. if the error is code related I will sort it out by myself. it seems the connection string is fine and the connection to Oracle Xe works.

    thats the main thing. thanks a lot!

    Friday, June 12, 2009 5:17 AM
  • User-1411985150 posted
    Hello I've got a problem, I have a Oracle db in a Windows 2003 server, the server has already installed the framework 2.0, and in the same server I published a web site in asp.net 2005, and this site should connect to the oracle db, but when you open any page which execute the following lines cmdComando = New OracleCommand cmdComando.Connection = New OracleConnection( string of connection) cmdComando.Connection.Open() Then, I get the message "A network-related or instance-specific error occurred while establishing a connection to SQL Server....." I don't undersand why appears this message, When I connect to this database from my source code in my pc, this works, this can connect normally but not from the published site. Could help me please Thanks in advance
    Tuesday, March 15, 2011 2:34 AM
  • User507956310 posted

    Hi hchf is the database hosted on a server that is available out
    of the network where "your pc" is located? how did you write
    the connection string? using localhost?

    Tuesday, March 15, 2011 3:32 PM
  • User2025951237 posted

    using ODP.NET in VS 2010 + MVC 3

    - Add reference to Oracle.DataAccess in References folder.

    - use  providerName="Oracle.DataAccess.Client"

     It should then recognise Oracle data provider.

    Regards

    Friday, June 21, 2013 10:34 PM