I'm having difficulty connecting to an Oracle database on Windows 7x64
My environment is as follows:
I've made the target CPU of all projects explicitly an x86 CPU (as opposed to Any or x86)
I'm connecting using DbProviderFactory.GetFactory
My ConnectionString entry in my app.config looks like this:
<add name="MYORACLE"
connectionString = "User ID=MYPASSWORD;Password=MYPASSWORd;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MYHOST)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=MYSERVICE)));"
providerName="System.Data.OracleClient" />
(I've tried it with various styles connection strings with no success)
When I compile the application, it is able to connect fine if I run the executable from the Debug folder. However, if I try to run it within Visual Studio it fails when I open the connection
ORA-06413: Connection not open.\n
Here's an example of how it's being called:
[TestMethod]
public void ConnectToOracle_Success()
{
var connectionStringSettings = ConnectionBuilder.GetConnectionStringSetting(OracleConnectionName);
var providerFactory = ConnectionBuilder.GetProviderFactory(connectionStringSettings);
ConnectionBuilder.ValidateConnectionString(connectionStringSettings);
using (var connection = providerFactory.CreateConnection())
{
Assert.IsNotNull(connection);
connection.ConnectionString = connectionStringSettings.ConnectionString;
try
{
connection.Open();
}
catch (Exception e)
{
Assert.Equals(e.Message, "");
}
}
}
I've seen something similar with Visual Basic 6 on Windows 7x64, and Oracle not liking the paths where it's installed (i.e., the parenthesis "Programs (x86)"). Is this the same sort of thing, or is there another way to convince Oracle to behave.
Oracle Database developers have a choice of languages for developing applications—C, C++, Java, COBOL, PL/SQL, and Visual Basic. The entire functionality of the database is available in all the languages. All language-specific standards are supported.
Connection URL: The connection URL for the oracle10G database is jdbc:oracle:thin:@localhost:1521:xe where jdbc is the API, oracle is the database, thin is the driver, localhost is the server name on which oracle is running, we may also use IP address, 1521 is the port number and XE is the Oracle service name.
This could be a OCI client version issue. See https://community.oracle.com/message/11103466.
I have seen a lot of issues with this. Most of the time this has to do with a ODP.NET assembly (such as Oracle.DataAccess) which is in a different version then the operating system architecture (we are talking bits here).
There are a few things you could do about this:
Install both 32- and 64-bit ODP.NET client tools (including OCI for that architecture), free to download from oracle.com.
Build your application for a specific processor architecture, such as 32-bit.
Use a third party Oracle client connector that is not dependent on OCI (this is what gives the problems). I wouldn't recommend this, since this is most of the time the expensive solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With