We help IT Professionals succeed at work.

C# Solution for Connect with Oracle 11g

Sandy_Kumar
Sandy_Kumar asked
on
1,077 Views
Last Modified: 2012-05-09
I need to write up a class library in C# to provide an interface for client to query for Oracle 11g database.

Right now i am looking for best approach to write DAO layer to connect with Oracle 11g. What are best technique to follow in terms of using DataSource with connection polling? What about ODBC? I want to use ODBC with DataSource. Can you provide me any sample application link to get into the details.

Thanks
Comment
Watch Question

Dirk HaestProject manager
CERTIFIED EXPERT

Commented:
DAO ? You need to use ADO.NET !

Getting Started with Oracle Data Provider for .NET (C# Version)
http://www.oracle.com/technology/obe/hol08/dotnet/getstarted-c/getstarted_c_otn.htm
Anil GolamariFull Stack Developer
CERTIFIED EXPERT

Commented:
http://www.oracle.com/technology/pub/articles/cook-vs08.html

Here in above link you got detailed explanation for connectivity to oracle using C# and also sample code.

Author

Commented:

Thanks for the link "http://www.oracle.com/technology/pub/articles/cook-vs08.html"
I am using the generic .Net interfaces DbProviderFactory and DbConnection in my appllication and i am passing System.data.oracleclient provide to DbProviderFactory and geting successfully the providerFactory object but as soon as i try to open the Db Connection i am getting the following errors

1. if i make the connection string in the format  ConnectionString= "Data Source=ServerName:Port/ataBaseName;User Id=user; Password=Password;" then call Conneciton.Open() method to open the Database connection then the function never return back and my application gets hangs.
2. if i make the connection string in the fomat ConnectionString = "Data Source=(DESCRIPTION="
             + "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=ORASRVR)(PORT=1521)))"
             + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)));"
             + "User Id=scott;Password=tiger;"; then call the Connection.Open() method then it throws me the error " System.Data.OracleClient.OracleException: ORA-12537: TNS Connection Closed.

I am not understanding the reason for this error. Can you please help me to find out the reason for this problem.

Thanks,
Full Stack Developer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks The solution was helpful to get the root cause of the error
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.