IIS site not connecting to Oracle database - oracle

I have a server with IIS that hosts web sites.
Some of those web sites (Silverlight) must connect to an Oracle Database to perform queries via OleDb, but they cannot.
Here are the results of what I tested :
'msdaora' provider is not registered on local machine when I run it in the web site
ORA-01019: unable to allocate memory in the user side (when I try to connect with a test console program without administrator status)
Connection OK (with the same test console program WITH administrator status)
ORA-12154: TNS:could not resolve the connect identifier specified when trying to switch to another method of connection (from OleDb to Oracle.ManagedDataAccess.Client)
I went through countless info about these kind of errors but I couldn't find any working solution.
Here is what I tested :
giving "create global objects" right to the relevant users (no change at all)
installing several Oracle clients one after another. Best result is with 10.2 client 64b (where my test program can connect while having administrator rights). The install is clean (no several Oracle folders nor several Oracle environment variables at the same time)
disabling warnings concerning the administrator elevation (ie no confirmation pop up during elevation) : no change at all
checking RAM usage (plenty of memory under the foot)
Additional infos :
The connection string is
Provider=msdaora;Data Source=HOSTNAME;User Id=USER;Password=PASSWORD
Same connection string used with OleDb and Oracle.ManagedDataAccess.Client.
The tsnames.ora file exists (and works, as show my succesful attempt with the administrator test program)
It's working on an older web server, but there are too much differences for me to find any meaningful one (different Windows, 32/64b, different IIS versions, different Oracle client)
Any idea ?

There are several points:
Microsoft msdaora provider for OLE DB is deprecated for ages. You should prefer the Oracle Provider OraOLEDB.Oracle.
Oracle Client and OLE DB provider and IIS application have to have the same architecture, i.e. all must be either 32 bit or 64 bit, you cannot mix them. (ancient msdaora is not available for 64 bit). However, ODP.NET Managed Driver (Oracle.ManagedDataAccess) works for both 32 bit and 64 bit.
When you use ODP.NET Managed Driver then Provider=MSDAORA is not needed in ConnectionString. I assume such attributes is ignored or you just missed to mention it.
Version of Oracle Client and OLE DB provider must match (even minor version). Due to COM limitation you cannot install more than one OLE DB provider for 32 bit and 64 bit each.
Search pattern for tnsnames.ora file in OLE DB is different to search pattern in ODP.NET Managed Driver. Verify following items:
OLE DB reads your Registry for TNS_ADMIN value, the ODP.NET Managed Driver does not.
ODP.NET Managed Driver uses your .NET config file (i.e. web.config, machine.config) to determine location of tnsnames.ora file, the OLE DB does not.
According documentation ODP.NET Managed Driver does take into account the TNS_ADMIN Environment variable and folder %ORACLE_HOME%\network\admin. However, according to my tests it does anyway.
Regarding connection failure is depending on "Rus as Administrator" check permissions of your Oracle installation folder.

Related

Unable to connect to Oracle database from SSAS

I am attempting to create a Sql Server Analysis Services Tabular Model and am having trouble accessing an Oracle database for importing data. I am using the following:
OS
-Windows 10 Enterprise (I am administrator of machine)
Tools to create tabluar cube:
-Visual Studio Community 2022 (64 bit) - Current Version 17.2.5
-SQL Server Analysis Services 15.0.2000.5 - Developer Edition (installed on localhost, services running)
Oracle database:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 Production Version 21.3.0.0.0 - Developer Edition (installed on localhost), up and running and able to connect with other tools (e.g. Toad, Sqlplus, SqlDeveloper, cx_python, etc..)
I have a 64-Bit System Data Source Name created for ODBC connections, using Oracle Instant Client. This data source works just fine with other tools mentioned in the Oracle databse section above.
When creating a SSAS tabular model in Visual Studio and attemping to import a data source, I try the following:
Models
-TabularProject (my project)
-Data Sources > New Data Source > Oracle Database
At this point I get the following message:
Oracle Database
The recommended provider ('Oracle.DataAccess.Client') is not installed. You can continue with your current provider, however, it has been deprecated and may not work correctly.
and I click 'OK'.
From here, I enter the connection string of my locally hosted oracle database (localhost:1521/MY_DB.
When prompted for credentials, I select 'Database' and then enter the correct username/password to connect to my locally hosted oracle database.
Then I receive an error stating:
Unable to connect
We encountered an error while trying to connect.
Details: "An error happened while reading data from the provider: '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.'"
I've also tried the following method:
Models
-TabularProject (my project)
-Data Sources > New Data Source > ODBC
Then I choose my ODBC datasource for my locally hosted database (which seems to work fine for other apps) and I receive the following error:
Unable to connect
We encountered an error while trying to connect.
Details: "ODBC: ERROR [IM014] The specified DSN contains an architecture mismatch between the Driver (64-bit) and Application (32-bit)"
I have installed various Oracle Drivers including:
-64-bit ODAC: ODAC122010Xcopy_x64.zip
-64-bit instantclient basic: instantclient-basic-windows.x64-21.6.0.0.0dbru.zip
-64-bit instantclient odbc: instantclient-odbc-windows.x64-21.6.0.0.0dbru.zip
-64-bit instantclient sqlplus: instantclient-sqlplus-windows.x64-21.6.0.0.0dbru.zip
I have also tried these same steps for a remote hosted Oracle database (using both ezconnect string and a ODBC DSN) and even though the connections work just fine with other apps, it doesn't work with SSAS for some reason.
Any and all insight advice to get my SSAS tabular model connected to Oracle databases would be very much appreciated.
EDIT:
I have tried following a solution from this similar question and create a dsn, suffixed with _64, using only the 64-bit ODBC manager, yet I get the same results when trying to use that DSN with SSAS.
I have also tried the following steps, per Microsoft:
From https://learn.microsoft.com/en-us/sql/reporting-services/report-data/oracle-connection-type-ssrs?view=sql-server-ver16#64-bit-and-32-bit-drivers-for-power-bi-desktop:
2. Register ODP.NET Unmanaged Client to GAC:
C:\Oracle\odp.net\bin\4\OraProvCfg.exe /action:gac /providerpath:C:\Oracle\odp.net\bin\4\Oracle.DataAccess.dll
3. Add ODP.NET Unmanaged Client entries to machine.config:
C:\Oracle\odp.net\bin\4\OraProvCfg.exe /action:config /force /product:odp /frameworkversion:v4.0.30319 /providerpath:C:\Oracle\odp.net\bin\4\Oracle.DataAccess.dll
Yet, I still receive all errors shown above.

Connecting to Oracle PDB via ODBC

I have a LOCAL Oracle 19c database. I am trying to get ADO to connect to it. The first step is to get ODBC working. I have one PDB container called orclpdb, which is what I want to use. I can connect from SQL*Plus...
Y:\INSTALL_UNZIP\bin\sqlplus.exe acs/<Password>#localhost:1521/orclpdb
I go into the 64-bit ODBC Administrator, and had to fight a little bit (adding OCI_LIB32 and TNS_ADMIN paths), but finally got the ODBC Admin tool to connect, but ONLY to the root/system database. My root question is 'How do I get ODBC administrator to connect to a specific container DB?
Within the ODBC Administrator, the TNS Service Name field dropdown only shows ORCL, not orclpdb. Again, I can connect using ORCL, but as system/.
UPDATE: Due to issues such as this, I switched most apps to Devart's Oracle Data Access components to Delphi. They have a DIRECT mode, which does not need SQL*Net or TNS stuff
.
Make sure your TNS_ADMIN/tnsnames.ora file has an entry for the PDB (orclpdb).

Export Database connection to Oracle Developer

I have a database Connection established in odbcad and Microsoft Access (aswell as working in Excel) via ODBC and want to also get it working in Oracle SQL developer.
It is a Windows SQL Server as far as i know and I have tried several Settings, of which None works. I have also installed Driver for ODBC. I would like to Import Settings into SQL developer as applied in MS Access, is there any possibility?
No, SQL Developer is a Java application and uses a JDBC driver.
But if you look at the odbc properties for your connection, those should largely translate to what you need to define a basic connection.
Oracle:
Server name or IP address of the DB, port # for the listener, and the name of the SID or Service, plus a valid username and password is all you need to connect to Oracle.
What error do you get when you try to connect?
Show us what you're trying.
Update:
You're trying to connect to SQL Server but you're getting"
Native SSPI library not loaded
You're trying to use OS Authentication for your connection. For this to work with the jTDS driver, you need to copy a DLL file named ntlmauth.dll (which is for NT authentication) under the jtds-x.x.x-dist\x86\SSO\ or jtds-x.x.x-dist\x64\SSO\, to any directories in the PATH environment.
Please update your question such that's it's clear you're connecting to SQL Server and share the error message so others can find it.
I imagine this question is a duplicate of many previous iterations of the same challenge.

Microdoft ODBC for oracle defined source not being picked up by application and throwing SQLConnect() failed

I have a 32 bit .net exe (on a win 7 machine) which runs and writes data to an oracle db. For this application to access the DB I have created a ODBC source (Microsoft ODBC for Oracle) under System DSN of odbcad32.exe from c:\windows\syswow64.
Instead of picking this source the application is picking a default connection source for the user. Please see below. (from sqlnet.ORA)
Fatal NI connect error 12560, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oracleORCL)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))(CONNECT_DATA=(SID=ORCL)(CID=(PROGRAM=D:\Projects\abc\Web\dll\reader.exe)(HOST=abc-43DGMX1)(USER=NGolia))))
The application (exe) is obviously not able to connect to the correct DB and throws a
ERROR SQLConnect() Failed.
Could anyone help let me know what could be missing? Am I missing any environment variables or
Are you able to test the connection in the Oracle ODBC Driver Configuration? If the application is 32bit, you're using the correct odbcad32.exe. I would check your tnsnames.ora in your $ORACLE_HOME and verify the database information looks correct there.

JBoss application cannot make XA connection to Oracle 11g

I've been working on several JBoss applications where I have everything running on my laptop (Windows XP) including an Oracle database (11g Enterprise Edition). Everything works fine on the laptop.
Now I'm setting up a new, faster machine (running Windows 7 Professional) and the non-XA JBoss apps run fine but the apps requiring an XA connection cannot connect to Oracle. I'm pretty sure it is a problem with my new Oracle installation because I can point the apps to an external Oracle server and they work, but they fail to connect when pointing them my local Oracle database.
I've done a lot of google searches and the only information I can find is that I need to run the script $ORACLE_HOME/rdbms/admin/xaview.sql to create some XA views and I need to grant the following permissions to the user:
GRANT SELECT ON sys.dba_pending_transactions TO <user>;
GRANT SELECT ON sys.pending_trans$ TO <user>;
GRANT SELECT ON sys.dba_2pc_pending TO <user>;
GRANT EXECUTE ON sys.dbms_xa TO <user>;
But after doing all that, I still cannot get the apps to connect.
This is the exception I'm getting:
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Io exception:
The Network Adapter could not establish the connection) at
org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAMangedConnectionFactory.java:144) at
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventLisener(InternalManagedConnectionPool.java:577) at
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:262) at
org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:500) at
org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:347) at
org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:330) at
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:402) at
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849) at
org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:90) at
org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46) at
org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
I know this isn't really a programming question, but I was hoping someone had seen this before. Any help would be much appreciated.
I was able to resolve this issue by ensuring that the host name and domain name settings in the LISTENER.ORA file and in the TNSNAMES.ORA file matched. For example, if one had HOST = localhost and the other had HOST = myhost.xyz.com then it would cause problems for XA but not for normal Java JDBC connections. My theory is that some part of the XA stack needed to make an OCI connection that read the TNSNAMES.ORA file but then could not connect because of a mismatch with the Listener configuration. Normal Java JDBC connections don't care about the TNSNAMES.ORA file as they make a direct connection to the listener with their own configuration settings.
I also had to rename some folders from xxx_localhost_yyy to xxx_myhost_yyy to get the Enterprise Manager to work.
To get TOAD to work I had to install the 32 bit client as it will not work with the 64 bit client and I had to configure it's ORACLE_HOME variable in the Windows registry under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Oracle. Apparently Wow6432Node is a special place in the Windows registry for defining values that only 32 bit applications will see.
Anyway, I'm relieved to have it all working.
Well, can you connect using a sql client to this database ?

Resources