When setting up an ado.net connection to an oracle database/server using an ado.net oracleClient data provider setup, I get the following error:
Test connection failed because of an error in initializing provider.
Attempt to load Oracle client libraries threw
BadImageFormatExxception. This problem will occur when running in 65
bit mode with the 32 bit Oracle client components installed.
However, I have already set the project property of run64bitRunTime = False.
When I try to set up the connection using the OLE DB provider for Oracle, I get the following error:
Oracle client and networking components not found. These components
are supplied by oracle corporation and are part of oracle version
7.3.3 or later client software installation. Provider is unable to function until these components are installed.
However, the components are installed.
Perhaps it's an issue with how I'm setting up my connections? From my tnsnames.ora file, my connection format is the following (I've changed actual address names):
server_usr.world =
(description =
(address = (protocol = TCP)(host = some.address.org)(port=1571))
(connect_data = (server = dedicated)(service_name = server_usr.something.org))
In both the examples above, I was inputting some.address.org into the server address. Is there a type of connection where I can put in the whole connection string listed above?
Related
I am migrating a .Net 4.6.2 application from using Microsoft's System.Data.OracleClient to Oracle's own managed ODP.Net (Nuget package, version 12.2.11)for connecting to an Oracle database. I have the Oracle client installed (11gR2) and apart from changing references, using clauses, type names etc the code is pretty much the same. However, whilst my pre-migrate code connects quite happily, the post-migrate will not connect. Instead it throws an OracleException
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA.
The tnsnames.ora file is the same, and the application's connection string is the same, and I have never before needed to specify a service name.
TnsNames.ora:
ORACLEDBSERVER2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = OracleDBServer2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = orcdb10g)
(SERVER = DEDICATED)
)
Connection string:
USER ID=MATTESTNHADMIN;PASSWORD=XXXXX;DATA SOURCE=oracledbserver2
Why is it now demanding a SERVICE NAME? Even if I add a clause to the CONNECT_DATA part (SERVICE_NAME = orcdb10g) I get the same error.
I assume your program does not find the tnsnames.ora file. Unlike the old drivers the ODP.NET managed driver does not read TNS_ADMIN value from the Registy.
See this answer https://stackoverflow.com/a/28283924/3027266 to see how ODP.NET managed driver is looking for tnsnames.ora file.
Note, when you use ODP.NET managed driver then you don't have to install any further Oracle client.
I followed the instructions in the link: https://m.youtube.com/watch?v=ONGz9czAikE
And got to the point of testing a Local Net Name Configuration(8:30) when i got to the point of preforming the test it seems like the window is stuck, same thing happens when i try to connect to the server db with Sql developer there i get a socket timeout error after waiting few minutes.
I'm trying to avoid downloading the oracle client software because of a company long security verification protocol.
What am i missing? Any help will be appreciated.
From here:
Oracle 12c server cannot be accessed from remote computer using the .Net provider
Try using an external IP instead of hostname like so:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.30.50.90)(PORT = 1521))
)
)
I am trying to connect to a Primavera P6 Database hosted on my network with driver Oracle in OraDb11g_home1. I currently have readonly access via the frontend, which I can successfully navigate records this way.
However, every attempt I have made to connect with a DSN has failed. I'm assuming that if I can connect to the frontend (even if readonly) that I should be able to connect via DSN with the same credentials?
The farthest I have gotten leaves me with an invalid username/password error. Here are the connection details:
in tnsnames.ora:
CHPPRIPA.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xamxilux002)(PORT = 1521))
)
(CONNECT_DATA =
(SID = CHPPRIPA)
)
)
I have similarly tried connecting using JDBC Driver (using a connection string) with the same username and password where
driver = "oracle.jdbc.driver.OracleDriver"
and
db_url = "jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=ramxilux002)(PORT=1521)))(CONNECT_DATA=(SID=CHPPRIPA)))".
username = "csdba" # (Central Services Database Admin);Level 1 - P6 Client - View Only
I still get the same invalid username/password error.
Am I wrong in believing that the same credentials should get me the same access in both places? Anyone experience this problem?
The user interface known as P6 Professional or P6 Web uses different login credentials than what you need to get into the database. Only the DBA can give you those credentials.
Additionally, I would like to ask why you feel you need access to the database. This will impact how you connect to the database and which schema to use.
The SID you are showing is not typical of the "stock" installer/upgrader for Oracle databases running Primavera P6.
There are FIVE schemas in the Primavera P6 database. It is strongly recommended that you not attach to any except the extended schema for reporting.
I am trying to connect into Oracle through Power Query > From Database > From Oracle Database and then I type BI_TST, which is within my TNSNAMES (located in: C:\oracle\product\10.2.0\client_2\network\ADMIN), and has the connection below inside:
BI_TST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv-oracle3.mycompany.com.br)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bitst)
)
)
Also i have the variable path configured as TNS_ADMIN=C:\oracle\product\10.2.0\client_2\network\ADMIN.
When I use SQL Developer to connect, not using TNS put setting all the information manually, it works!
When I try to connect using TNS within Excel I get the error:
Message=ORA-12154: TNS:não foi possível resolver o identificador de conexão especificado
ErrorCode=-2146232008
Wich means in English: "could not resolve the connect identifier"
Could anyone please help me in this issue?
Thanks in advance!
Honestly, I've had my fill of tnsnames. I understand the idea behind it and can appreciate that, but I spend more time figuring out why it's not working than I do saving the extra keystrokes.
In my opinon, just bypass TNSnames use Oracle's ezconnect:
srv-oracle3.mycompany.com.br:1521/bitst
In place of:
BI_TST
This should work for ODBC as well. If you can't direct connect through PowerQuery's Oracle driver, try going through ODBC. While it's an additional layer you probably don't want, I doubt you'll notice a performance difference, and it may abstract the difficulties you normally have to deal with.
To clarify Hambone's response, to connect Excel to Oracle via Oracle client driver without using TNS Names:
Go to Control Panel > Administrative Tools > ODBC Data Sources
Go to File DSN tab
Choose Oracle driver (e.g. Oracle11gr1)
Provide a name for the new data source (any name)
When prompted for Service Name, enter host:port/servicename e.g. db123:1521/service123
Hope this works for everyone.
We recently changed physical DB's, new servers, new locations, same database schema and data and since the change over, whenever we try to connect directly to the DB in our own desktop type applications about half of the time we get this error:
SQL*Loader-704: Internal error: ulconnect: OCIServerAttach[0]
ORA-12545: Connect failed because target host or object does not exist
The rest of the time, it connects right away without any issues. Our applications that establish connections via JDBC don't seem to have any issues but we do when going through something that does a tnsnames.ora lookup (or that's my hunch at least). TNSPING works 100% but using an oracle executable like SQLLDDR fails at least 50% of the time. Here's an anonymized snppet of our TSNNAMES file and a TNSPING output:
DB_CONNECTION =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.2.3.4)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = MY.URL.COM)
)
)
And the TNSPING:
C:\>TNSPING DB_CONNECTION
TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\oracle\ora92\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 1.2.3.4)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = MY.URL.COM)))
OK (200 msec)
I have the SID of the DB, which is what the JDBC connections rely on but adding it to the tnsnames.ora doesn't improve the odds of making a connection. I don't know enough about how the tnsnames file is being used by Oracle to intelligently resolve this issue. What can I try?
Edit
The new DB's may be two load balanced databases which may be part of the problem.
We recently had a similar issue with our application. The application would sometimes connect to the Oracle RAC and sometimes it would complain with ORA-12545.
In short the issue was that the server had a real name while we were using virtual IP addresses in TNSNAMES.ORA. Once we added the mapping of the server name to IP address via system32\drivers\etc\hosts file everything started to work properly.
I have written a bit more in my blog
<shameless advert>http://dcarapic.blogspot.com/2009/04/intermittent-ora-12545-error.html</shameless advert>
Ah, gotta love the intermittent problems :)
(In the following I have had to replace the underscore character as I don't know the escape char for this wiki language)
Are you always using the same OS user to connect and to do the tnsping?
Check for environment variables TNS[underscore]ADMIN pointing to different tnsnames.ora locations. Do a scan of the client for duplicate tnsnames.ora; either in locations pointed to by $TNS[underscore]ADMIN or in different $ORACLE[underscore]HOMES (e.g. if you have 2 Oracle client installs).
Likewise check that you are using the same $ORACLE[underscore]HOME and $PATH environment variables for all connection attempts and tnsping. (E.g. always the same OS user or each user has the same values)
I see that the tnsping output reports version 9.2 so this is not likely, but in 11g the DB registers with the listener which can take a minute or so. (maybe also true with 10g). Attempts to connect prior to this will not find the target.
Another unlikely possibility - is a service with the same service name still advertised on the old host server? Remove it if at all possible.
After that I would start to look at the network itself. Is a ping of the server always successful and quick? If you're using the hostname rather than IP in the tnsnames.ora, does the hostname reliably resolve to the correct IP (nslookup). Is there a local firewall and if so is it behaving?
Regards
Karl
If you are using Oracle 10g, you may use an Easy Connect handler instead:
//servername/instancename
,
//1.2.3.4/my.url.com
in your case.
It's immune to lots of TNSNAMES issues.