Oracle connection Fails

  • Thread starter Thread starter Saquib
  • Start date Start date
S

Saquib

Hi All,

I have built a simple .Net console application. In which i am trying
to connect to the oracle database by using Oracle data provider
for .Net from ORACLE site and it works fine on my machine. I have
installed the same on my main server but when i run this application
from Our main server i am getting an exception. The exception is as
follows.

'Oracle.DataAccess.Client.OracleException at
Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32
rrCode, OracleConnection conn, IntPtr opsErrCt
x, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32
errCode, Oracle
Connection conn, IntPtr opsErrCtx, Object src)
at Oracle.DataAccess.Client.OracleConnection.Open()
at TestODACWithWindows2000.Program.Main(String[] args)'


I am not able to trace out the exact cause why it is failing from that
server. While the oracle server is pingable from that server.

My application is as follows


using System;
using System.Collections.Generic;
using System.Text;
using Oracle.DataAccess.Client;
using System.Data.SqlClient;
using System.Xml;
using System.Data;
using System.Xml.XPath;
using System.Xml.Xsl;
using System.IO;

namespace TestODACWithWindows2000
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Opening........");
string ConnectionString = "Data
Source=(DESCRIPTION="
+
"(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=Host)(PORT=1521)))"
+
"(CONNECT_DATA=(SERVER=DEDICATED)(SID = SID)));"
+ "User
Id=username;Password=password;";

OracleConnection ora = new
OracleConnection(ConnectionString);
try
{

ora.Open();


}
catch (Exception ee)
{
Console.WriteLine("{0} Exception caught.", ee);
Console.ReadLine();
}
}
}
}



Please help me out.. Its urgent.
 
When you say you can't trace it out, what have you used? Are you using
Sql_Trace? That should show you what's attempting to be sent to the server.
If it works on your other machine, than it almost seems more like a problem
w/ a missing dll a la MDAC variety. I might be inclined to think something
was blocking it on the server but you said you can definitely get to the box
from there.. It might be worth getting rid of the concatenated strings and
using a ConnectionStringBuilder just to rule out anything along those
lines - or, just to help isolate things - hard code the connection string
directly without using variables - just temporarily so you make sure
everything is kosher there. I assume you've already verified that all of
those variables are set to the exact values on the client machine right?

--
bill.ryan | technology.evangelist | magenic.technologies
mvp - device application development
http://www.msmvps.com/WilliamRyan
http://www.magenic.com
Saquib said:
Hi All,

I have built a simple .Net console application. In which i am trying
to connect to the oracle database by using Oracle data provider
for .Net from ORACLE site and it works fine on my machine. I have
installed the same on my main server but when i run this application
from Our main server i am getting an exception. The exception is as
follows.

'Oracle.DataAccess.Client.OracleException at
Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32
rrCode, OracleConnection conn, IntPtr opsErrCt
x, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32
errCode, Oracle
Connection conn, IntPtr opsErrCtx, Object src)
at Oracle.DataAccess.Client.OracleConnection.Open()
at TestODACWithWindows2000.Program.Main(String[] args)'


I am not able to trace out the exact cause why it is failing from that
server. While the oracle server is pingable from that server.

My application is as follows


using System;
using System.Collections.Generic;
using System.Text;
using Oracle.DataAccess.Client;
using System.Data.SqlClient;
using System.Xml;
using System.Data;
using System.Xml.XPath;
using System.Xml.Xsl;
using System.IO;

namespace TestODACWithWindows2000
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Opening........");
string ConnectionString = "Data
Source=(DESCRIPTION="
+
"(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=Host)(PORT=1521)))"
+
"(CONNECT_DATA=(SERVER=DEDICATED)(SID = SID)));"
+ "User
Id=username;Password=password;";

OracleConnection ora = new
OracleConnection(ConnectionString);
try
{

ora.Open();


}
catch (Exception ee)
{
Console.WriteLine("{0} Exception caught.", ee);
Console.ReadLine();
}
}
}
}



Please help me out.. Its urgent.
 
Back
Top