Oracle Data Access Components and Visual Studio connection problems - oracle

I've created an empty console application in Visual Studio 2010 and I'm attempting to add an Oracle (10g XE ) Data Connection via the Server Explorer. I'm using Oracle ODP .NET as the connector and I get the following error:
ORA-12560: TNS: Protocol Adapter Error
I can access Oracle without issue via the web interface or a console, but continually get this generic connection error in VS. I'm using the default installation of Oracle XE and running it locally.
Any suggestion on how to get this set up correctly ? Every tutorial I find works on the understanding that this connection succeeds. As such I'm struggling to find where to begin to troubleshoot. I'm comfortable with VS2010, but new to the way Oracle does things with their DB.
EDIT 1
While troubleshooting I've found this only happens with the Oracle Data Provider for .NET. Using the .NET Framework Data Provider for Oracle I am able to successfully connect.
EDIT 2
I cleaned up everything and installed 11g XE and the ODAC tools again and continue to get the same message. I realize the error is somewhat generic, I'd be happy to post more information if anyone thinks it helpful. The database is run locally, I can't imagine what kind of 'configuration' an express database would even need...
EDIT 3
The ODAC tools appear to install a 'production' version of Oracle 11 instead of the BETA version that I installed first. Almost appears as if the tool is installing another database ? I also appear to have two ORACLE_BASE locations and two TNSNAMES in what appear to be very similar folder hierarchies. Perhaps a more straightforward tutorial is the answer, Oracle's isn't very descriptive.

Oracle 10g XE seemed to be the problem. A full install of 11g (Full, not Express) took care of the problem entirely.

From here:
Possible fixes for the TNS-12560
include:
Get the latest patches for the SQL*Net client software.
Check your $ORACLE_HOME and $Path variables.
Check File permissions on the PC client.
Ensure that TNS_ADMIN is set correctly.
Check for firewall issues.
Check that the Windows database service is started. Verify teh
ORACLE_SID parameter is set correctly
in the registry.

Wow. I finally got this syntax to work.
I'm a Sql Server guy. I used Oracle back in the da day.
But I'm trying to do some Entity Framework and I said "You're not going to bed until you get Visual Studio 2012 and a edmx file to talk to Oracle.
Geeze.
Here is what I came up with:
Data Source:
Oracle Database (Oracle ODP.NET)
Data Source Name:
localhost:1521/orcl
User Name:
SYSTEM

change the default data source name to localhost.

Related

SSRS in SharePoint integrated mode - ORA-03135 when querying Oracle database

We have successfully installed SSRS in SharePoint integrated mode. We can run reports with data sources pointing to MS SQL database.
We need to add support for reports querying Oracle 12c database.
After the drivers installation we can create a data source with "Oracle Database" data source type. But when we try the "Test Connection" button, we always get the "ORA-03135: connection lost" error. Reports based on this data source always fail.
We use these versions: SharePoint 2016, MSSQL 2016, Oracle 12c.
Did anybody come across this error? How did you solve it?
Thanks.
We had to install an Oracle patch to ODAC drivers. After installation of the patch we got rid from this error.
Most likely the error was raising because of the Oracle Advanced Security option.

Can't add Local Database to project

This might be a really dumb question... but in VS2013 when trying to add a local database to my Windows Forms Application Project the option is now shown in the C# items menu. The only DB that is available is a Service-Based DB. From what I understand, this is related to SQL Compact Edition but I do have SQL Server 2012 installed. Any ideas? Or are there any significant differences between the Local DB and Service-Based DB?
A service-based database is a database that is only accessed through a server. It uses an MDF data file, which is SQL Server format. To be able to connect to a SQL Server database the SQL Server service must be running, because it's that that processes your requests and access the data file.
A local database is one that is local to your application only. It uses an SDF data file, which is SQL Server CE (Compact Edition) format. There is no need to install a server to access an SDF database. You simply distribute the DLLs that constitute SSCE along with your app and access the data file directly.
You'd normally only use SSCE if the data was to be accessed by your app only and there was a relatively small amount of data. For your project you would use SQL Server. For testing purposes you can use the free Express Edition. When deployed you might still use SSEE or you might use a full version of SQL Server. Note that Microsoft include SSEE with their own RMS POS software. SSEE is limited to databases of 4GB though, so even if you start out with SSEE and it can handle the load, you may still have to upgrade at some point in the future based on data capacity.
Source of info:jmcilhinney post.
for help on creating the database have a look at this tutorial it may be of some help.
Hope this info helps you :)
It turns out VS2013 dropped the .sdf format.
Is Microsoft dropping support for SDF database files in Visual Studio?
The answer is yes: Microsoft is silently dropping support (as usual IMHO) to Sql Compact Edition.
It started abandoning Sql CE 3.5 in Vs2012 It continued dropping Sql CE in Sql Management Studio 2012 and finally in VS2013
You can use CompactView or install SQL Server Compact Toolbox extension in VS2013 or (my prefered solution) use Sql management Studio 2008
UPDATE thanks to Nicolas' comment
As stated by Microsoft:
SQL Server compact edition is in deprecation mode with no new releases planned near future. Last release SQL CE 4.0SP1 (and earlier releases that are still in the support cycle) will continue to be supported through its lifecycle and Microsoft is committed to fix any major, production blocking issues found in these releases.
Have you tried adding your local database from inside the project? Have a look and see if you can add your database from datasources.

Getting BIDS 2008 R2 to connect to Oracle using MSDAORA on Windows 8

I have a new dev machine, and I need to support legacy SSIS packages. The new machine is Windows 8 64 bit with a SSD primary drive (C:) and a regular HDD for data (D:). On it, I have installed BIDS 2008 R2 (and all the tricks to get it to work with TFS2010), as well as VS2010, ODAC 32 bit and 64 bit (I think??), Oracle Client (SQLDeveloper).
I can get the following to connect just fine to an Oracle database:
VS2010 with MSDAORA
VS2010 with ODAC
VS2010 with ADO.NET
Test connection using .udl file with Oracle OLE DB Provider (MS provider does not show up as an option here)
SQLDeveloper (Oracle's Client Tool)
What I CAN'T seem to do is get BIDS 2008 R2 to connect to Oracle using ANY method (MSDAORA, ADO.NET, ODAC).
The problem seems isolated to my machine, I can otherwise open, view, validate, connect and run these packages on other machines with no issues.
I have tried the following:
Ensured any/all TNSNAMES files are correct and identical (taking working copies from other machines, and let's not forget, this works fine in VS2010)
Created ORACLE_HOME and TNS_ADMIN Environment Variables and pointed them to various directories within D:\app\username\product\11.2.0
Checked registry manually to make sure no other references to ORACLE except for the entries in HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
Unistalled/Reinstalled SQL Server 2008 R2 components
Every "solution" offered in every thread in every search I have tried
Thrown chicken bones and offered sacrifices to pagan deities
After each attempt at a fix, I still get the following error when trying to Preview a SQL Command in the Data Flow:
An OLE DB record is available. Source: "Microsoft OLE DB Provider for Oracle" Hresult: 0x80004005 Description: "Error while trying to retrieve text for error ORA-01019"
Yes, I know I need to drop MSDAORA in favor of ODAC, and if ODAC worked in BIDS 2008 R2 I would certainly do it. However, I can't get anything to connect to Oracle there (even though, as mentioned above, it connects fine in various other tools)
I have two "client_n" directories in D:\app\username\product\11.2.0. As mentioned, I have tried pointing my environment variables to various paths inside. It seems like the correct path for ORACLE_HOME should be just D:\app\username\product\11.2.0, correct?
Has anyone had any luck getting BIDS 2008 R2 to connect to Oracle while on WINDOWS 8 with VS2010 also installed? It seems to me like it's a simple Oracle connection issue, I just don't know enough about Oracle to troubleshoot.
Any other ideas to try?
BIDS is x32 (even on an x64 machine), so you will need to install the Oracle Client x32 edition, Full Install.
We were able to get it to work, though I believe that we installed too much software. (I have not been able to test it with only the ODAC drivers.)
Install the Oracle Client 32 & 64-bit drivers.
Install the Oracle ODAC 32 & 64-bit drivers.
In BIDS use the native Oracle connection, and not the Microsoft driver.

Understanding Oracle database and ODAC installation

I want to use Oracle XE DB in my ASP.NET MVC project. I installed Oracle 11g XE on same machine where is VS running. Installation completed succesfully in C:\oraclexe. Everything as expected, i was able to connect to DB via Server Explorer using default .NET oracle data acces provider. But i want to use ODP.NET, so i installed ODP.NET + ODT in C:\app. Here is first confusing thing. Directory structure of C:\oraclexe..\server and C:\app..\client_1 is similar. Both have NETWORK\ADMIN folder where Tnsnames.ora resides. I understand that client is used to connect to database but:
Which Tnsname.ora will be used to connect to database?
Oraclexe also contains odp.net folder where Oracle.DataAccess.dll resides. If server installation come with odp.net why i need to install ODAC? Server Explorer in VS offered me ODP.NET drivers for connection only after ODAC install.
ODAC comes with Oracle Instant Client. When to use Oracle Client and when Oracle Instant Client? If i decide for Oracle Client and then i will install ODAC for connection, will it also install Instant Client which is part of ODAC?
Finally after installation of server and client, VS 2010 still does not offer me Oracle Providers in ASP.NET Configuration
Oracle XE is kinda special in that you typically install the server and client on the same machine. Logically, they are separate, but it does make things a bit harder to understand. For that reason, I will refer to other experts.
The folks at ORAFAQ have information about the TNSNAMES.ORA file. My personal strategy is to make all my TNSNAMES.ORA files the same, so there is no opportinity for confusion.
ODP.NET is for... .NET use, while ODAC is "native" (OLE) and provides more tools than you may have with just ODP.NET. Use whatever works for your needs.
For most cases, you would distribute the Instant Client. The Full Client is more useful for developers. Refer to the documentation and FAQs for details. You can have multiple clients on one machine, so I'm not sure what the problem is.
Restart the machine? Did you add the appropriate library/libraries to your environment?

Is ODP.NET required for Oracle 11g Client?

I may be asking the wrong question here, I'm willing to change it if so.
I have a project that is using the Microsoft.NET Oracle provider (our plan is to change to ODP but we haven't done so yet).
I am trying to get this project to build on a windows 2008 (x64) build server. It builds just fine but our unit tests fail when they hit stuff on the Oracle database.
I had initially installed the 32bit oracle 9i client which is what we currently use on our winxp dev boxes and the previous 2003 build server. But now this gets a message like: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.
We tried compiling to the x86 platform but that didn't change the error message.
I now have the 11g 64 bit client installed but I am getting a message saying System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.
So what Oracle install should I be using?
Edit:
I was able to get this to work. Turned out it was the testing causing the problem, by forcing NUnit to run in 32bit mode: Link I was able to get the tests to work using the old 32 bit driver. This would be a crappy answer to the question so I am not using it but will gladly award the correct answer to anyone putting in some good info on transitioning to Oracle 64bit drivers.
When it comes to Oracle, I like to use Oracle Instant Client :
You don't have to install anything on the target machines (including dev boxes !).
You can make sure that your application will run with the specific client you picked.
You could even easily have multiple applications work with different client versions on the same computer.
As a downside, it adds a significant weight to your application (~19Mb minimum).
Check What is the minimum client footprint required to connect C# to an Oracle database? for more information. To know how to set up a Visual Studio project that will work on x86 as well as x64 machines, check my blog post Oracle Instant Client in Visual Studio.
I'm adding a new answer since as of this fall (2012) the ODP Managed Code Beta is available. See this link for more information. It is for us highly stable and we are using it in production, mainly because of these reasons:
No installation (except for entity framework where a simple registration is needed)
It is smaller than the unmanaged version, the footprint is approx 6 MB.
It is NOT "bit sensitive", ie Any CPU will finally work with ODP :)
More intuitive mapping C# types <-> Oracle types (and it solved some problems with EF and model generation from database)
Supports EZCONNECT (all versions of the unmanaged ODP did not), ie no more tnsnames.ora hassles.
But for transitioning to 64 bit, download the managed ODP driver and change the Oracle.DataAccess reference to Oracle.ManagedDataAccess and recompile :)
I think the message "System.Data.OracleClient requires Oracle client software version 8.1.7 or greater" it's similar to "Oracle client not installed, installed but not found or installed but it's needed 8.1.7 or greater".
Check on regedit if the values are right under the key:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraOdac11g_home1
Where OraOdac11g_home1 depends on the Oracle Home name for your installation.
Also, try to connect through Visual Studio to see if its possible.
I have had an issue which could relate to what you are seeing.
I initially had the just the Oracle 10g client installed on my machine and the .Net Oracle.DataAccess component version number was 10.2.0.100 - this was for .Net runtime v1.0.3705
I installed ODP.Net and the Oracle.DataAccess component version is now v2.102.2.20 and runs on .Net runtime v2.0.50727 - I cant find the reference as to why Oracle did this - it was something to do with bringing version numbers in line with the runtime version
It took me a day to work this out. We dont use the 11g client yet and I havent used the 8i client for ages so I dont know what the version numbers would be for those clients, but I'd check it if I were you what.
In short, Oracle back-tracked the component version numbers which could be making your 11g component appear out-of-date as opposed to Oracle 8i components
I have found many times that the error "requires Oracle client software version 8.1.7 or greater" is a notoriously misleading error. From distant memory I seem to remember that this usually indicates a file IO permissions problem. I think it may be that the ASP.NET worker process (or whichever identity an application is running under) requires some sort of read or write permission to a folder in the oracle client folder hierarchy...
This can be a cause of multiple oracle homes in the environment. Remove the older version oracle home in your build system. try generating the build again with the single home. There are some issues with 9i version ODP.NET and 10G/11G connectivity

Resources