tags:

views:

307

answers:

1

Hi I use the following code to connect to an orace database in Visual Studio 2008 and it is falling over with the exception of ServerVersion threw an invalid operation exception at line 3:

m_strConnectionString = Settings.GetMandatoryConfig("databases", "SourceDB");
m_strQueryTerminator = Settings.GetConfig("databases", "QueryTerminator");
m_odbConn = new OleDbConnection(m_strConnectionString);
m_sql = new SQL(DatabaseType.AnsiSQL, false);

m_strConnectionString is a valid TNS names connection string and is as follows:

Provider=MSDAORA;Data Source=myDS;User ID=myID;Password=myPW

This has previously worked and is using an IIS web server to host the application. I recently converted it from .Net 1.1 (VS 2003) to .Net 3.5/2 (VS 2008) and can't get it working as yet in VS 2008.

Thanks

A: 

Maybe you should consider using the OracleConnection class instead of the generic OleDbConnection. Doing this may give you more specific error information that what you're receiving now - and could help you find your problem quicker.

See here for more information on the System.Data.OracleClient namespace included with the .Net framework.

Scott Ivey
Perhaps that's fine to get started but I recommend picking up the Oracle Data Provider for .NET http://www.oracle.com/technology/tech/windows/odpnet/index.html instead since Microsoft will be deprecating System.Data.OracleClient in .NET 4.0.
Ahmad Mageed
great idea ahmad - i agree :)
Scott Ivey