Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem connecting oracle to a c# program

Re: Problem connecting oracle to a c# program

From: Dave Hau <davehau-no-spam-123_at_no-spam.netscape.net>
Date: Fri, 14 Nov 2003 17:18:51 GMT
Message-ID: <%78tb.372$c07.45@newssvr23.news.prodigy.com>


Try installing/reinstalling ODP.NET:

http://otn.oracle.com/software/tech/windows/odpnet/index.html

HTH,
Dave

"Ram" <tadepalli_ram_at_yahoo.com> wrote in message news:8343c21c.0311140830.15b37814_at_posting.google.com...
> Hi folks,
> I am writing a web service program in c#. I am using oracle as the
> database. The web service program has a method named
> getInfoFromID()which returns a person based upon an ID.
>
> When i try to fetch the record of a person using getInfoFromID() in
> the web service program,I am getting some exception.I am using oracle
> (SQL plus) as the database.
>
> When i execute the web service program, everything works fine. i.e. i
> get the http://localhost/InfoService/Records.asmx and when i click on
> the "getInfromFromID" link, i get
> http://localhost/InfoService/Records.asmx?op=getInfoFromID page. When
> i enter a valid ID value and say invoke i get
> http://localhost/InfoService/Records.asmx/getInfoFromID with the
> following exception:
>
> System.ApplicationException: Failed to connect to data source --->
> System.DllNotFoundException: Unable to load DLL (oci.dll).
> at System.Data.OracleClient.DBObjectPool.GetObject(Object
> owningObject, Boolean& isInTransaction)
> at

System.Data.OracleClient.OracleConnectionPoolManager.GetPooledConnection(Str ing
> encryptedConnectionString, OracleConnectionString options,
> OracleConnection owningObject, Boolean& isInTransaction)
> at

System.Data.OracleClient.OracleConnection.OpenInternal(OracleConnectionStrin g
> parsedConnectionString, Object transact)
> at System.Data.OracleClient.OracleConnection.Open()
> at PersonInfo.PersonDatabase.getInfoFromID(Int32 id) in
> c:\doc\info\personinfo\persondatabase.cs:line 30
> --- End of inner exception stack trace ---
> at PersonInfo.PersonDatabase.getInfoFromID(Int32 id) in
> c:\doc\info\personinfo\persondatabase.cs:line 64
> at InfoService.Records.getInfoFromID(Int32 id) in
> C:\DOC\Info\InfoService\Records.asmx.cs:line 88
>
> Following is my code:
>
> Records.asmx.cs
> --------------------------------------------------------------------------



> using System.Data;
>
> using System.Diagnostics;
>
> using System.Web;
>
> using System.Web.Services;
>
> using PersonInfo;
>
> namespace InfoService
>
> [WebService(Description="<b>This service lets universities Update and
> lookup student status with the fictitious security department
> infoBase</b>",Namespace="http://www.cs.uh.edu/cosc4319")]
>
> public class Records : System.Web.Services.WebService
>
> {
>
> public Records()
>
> {
>
> InitializeComponent();
>
> }
>
> ..................
>
> [WebMethod(Description="<i>Returns the Person with the given unique
> (int) ID</i>")]
>
> public Person getInfoFromID(int id)
>
> {
>
> Person thePerson = new Person();
>
> PersonDatabase personDB = new PersonDatabase();
>
> personDB.getInfoFromID(id); //---------------------------Line 88
>
> return thePerson;
>
> }
>
> }
>
> }
>
> --------------------------------------------------------------------------


>
> PersonDatabase.cs
>
> --------------------------------------------------------------------------


>
> using System;
>
> using System.Data.OracleClient;
>
> namespace PersonInfo
>
> public class PersonDatabase
>
> {
>
> public PersonDatabase()
>
> {
>
> }
>
> public Person getInfoFromID(int id)
>
> {
>
> OracleConnection nwindConn = null;
>
> OracleDataReader oReader = null;
>
> nwindConn = new OracleConnection("Data
> Source=Oracle;UID=system;PWD=cougar;Integrated Security=yes;");
>
>
> Person thePerson = new Person();
>
> try
>
> {
>
> nwindConn.Open(); //---------------------------Line
> 30
>
>
> OracleCommand cmd = nwindConn.CreateCommand();
>
> cmd.CommandText = "select
>

LastName,EntryDate,WithdrawalDate,FirstName,ID,Status,VisaDate,RegistrationD ate
> from PersonInfo where ID =" + id;
>
> oReader = cmd.ExecuteReader();
>
> // while(oReader.Read())
>
> // {
>
> //
>
> //
>
> // }
>
> }
>
> catch (Exception ex)
>
> {
>
> throw new ApplicationException("Failed to connect to data source",ex);
> //-----Line 64
>
> }
>
> finally
>
> {
>
> if(nwindConn != null)
>
> {
>
> nwindConn.Close();
>
> nwindConn = null;
>
> }
>
> if(oReader != null)
>
> {
>
> oReader.Close();
>
> oReader = null;
>
> }
>
> }
>
> return thePerson;
>
> }
>
>
> }
>
> }
>
> I have checked references and other things.Everything seems to be fine
> but for the exception.
>
> I got the data source name from control panel -> Administrative tools
> -> Data Sources (ODBC) -> System DSN (tab).
>
> It says:
>
> System Data Sources
>
> Name Driver
>
> Oracle Oracle in OraHome 92
>
>
>
> I have been struggling with this for some hours. Could anyone help me
> out.
>
>
> Thanks and Regards.
>
> Ram
Received on Fri Nov 14 2003 - 11:18:51 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US