Oracle SQL Developer - Issue with JDBC Driver - oracle

I've:
Windows 7 x64
My 11G Oracle client as per below
C:\Oracle\product\11.2.0\client_1
My SQL Developer (downloaded the kit with JDK 8 included, but installed the JSK separately just in case) dir as per below
C:\sqldeveloper
When I try to connect using TNS I have
no ocijdbc12 in java.library.path
If I go to Settings -> Database -> Advanced and choose my Oracle dir manually I get this:
Testing the Oracle Home located at C:\Oracle\product\11.2.0\client_1
Testing client directory ... OK Testing loading Oracle JDBC driver ...
OK Testing checking Oracle JDBC driver version ... Failed: Minimum
driver version 11.2.0.3 required, specified driver version is
11.2.0.1.0
So I looked into upgrading the JDBC driver, but I can't use the check for updates feature, since it appears to be blocked in my virtual machine.
I got the ojdbc7.jar from the SQL developer directory and copied it to C:\Oracle\product\11.2.0\client_1\jdbc\lib, and now I get the error below:
Testing the Oracle Home located at C:\Oracle\product\11.2.0\client_1
Testing client directory ... OK Testing loading Oracle JDBC driver ...
OK Testing checking Oracle JDBC driver version ... OK Driver
version: 12.1.0.2.0 Testing testing native OCI library load ...
Failed: Error loading the native OCI library The native OCI driver
could not be loaded. The system propertyjava.library.path contains the
entries from the environment variable PATH. Check it to verify that
the expected native library directory
C:\Oracle\product\11.2.0\client_1\bin is present and precedes any
other client installations. java.library.path =
C:\sqldeveloper\jdk\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Oracle\product\10.2.0\client_1\bin;C:\Oracle\product\11.2.0\client_1\bin;C:\Oracle\product\11.2.0\client_2;C:\Oracle\product\11.2.0\client_2\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ARQDISP\;C:\Program
;.
Have no idea what I'm doing at this point. Could you please help?

Its missing drivers. So in my case I installed Oracle Client from http://www.oracle.com/technetwork/topics/winx64soft-089540.html
and set the path variable accordingly.
Here's a blog post that shows how to tell SQL Developer where and which installed client to use :
https://www.thatjeffsmith.com/archive/2014/01/oracle-sql-developer-4-and-the-oracle-client/
Restart your SQL Developer.

I had similar issue. Moving from sqldeveloper 4.0 to 4.1, imported all my connections, but in 4.1, I would get 'no ocijdbc12 in java.library.path'.
I opened up my current connections (right-click on any connection and choose properties) all of which the connection Type is TNS. The 'Connect Identifier' was checked with the connections network alias name entered there. I checked on the 'Network Alias' check box and selected the same name and then the connection worked.
I went back to 4.0 to examine my connections there and it appears that the alias name works fine with the 'Connect Identifier' selected but not in 4.1
I had to update all my many connections to use 'Network Alias'.

Error loading the native OCI libraryThe native OCI driver could not be loaded and when trying to connect to a database i was getting no ocijdbc12 in java.library.path
For me the error was solved after i have created a new variable ORACLE_HOME with the value ....(path of the folder where the sql developer was insataled)\jdk\jre. Then i have added at the begging of the Path variable %ORACLE_HOME%\bin.
At first i have created a system variable that was pointing to the folder of the installation of the dev express and that was not working

For database selecting the connection properties and changing the connection type from TNS to Basic and providing the other details (Service name/SID) for the connection resolved the issue for me

Maybe it helps having a look into answer of my post about similar topic:
How to get Sqldeveloper 19.1 64-bit working with instantclient_12_2 on Windows enterprise PC without admin privileges?
The mentioned .bat file shows all you need.
If you have admin privileges or permissions to change any environment variables, then it will probably be the better way without using .bat file.

When I try to connect using TNS I have
no ocijdbc12 in java.library.path
It is so stupid and funny, at the same time, what I found.
I get the same error and the only difference between when it is OK and when is not is...
the TNS definition in tnsnames.ora
Simply add (maybe once again if it disappeared) the TNS definition of your database, like:
XE.WORLD=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=localhost)
(PORT=1521)
)
(CONNECT_DATA=
(SERVICE_NAME=XE.WORLD)
(SERVER = DEDICATED)
)
)
and restart SQL Developer.
Connection configuration will keep the name (XE.WORLD) even if it is already gone from tnsnames.ora. If it is not there, on the connection attempt, it will return that misleading error.
My setup: SQL Developer 4.1.4.21, ojdbc8.jar, connection to Oracle 19c.

Related

Can data source be changed for OBIEE 12C RPD?

I'm new to OBIEE. I have version 12.2.1.4 installed on a Linux server. I installed the client tools on my Windows PC. Using the Administration tool I created a simple RPD which uses only two tables. For this I had to first create an ODBC DSN to connect to my DB/2 database.
Next, I uploaded the RPD to the OBIEE server using the datamodel cli tool. When I go to the http://hostname:9502/analytics page and select to create a new analysis, it shows me the name of the repository and the two tables. I selected a couple of columns and clicked on the Results tab.
At this point, I get an error message: ODBC error state: IM002 code: 0 message: [DataDirect][ODBC lib] Data source name not found and no default driver specified
I had used the em console to create a JNDI connection to DB/2. But, from the message it seems that it is trying to use the ODBC connection that was used when creating the RPD on my PC.
How do I change the connection that the server is using?
The server needs to be able to reach the data source. EM JNDI connections have nothing to do with it, but rather the server (server OS - not the application) has to reach the source.
You need to update your ODBC settings on the Linux server: https://support.oracle.com/epmos/faces/DocContentDisplay?id=2570997.1

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).

Unable to connect through ODP Managed driver

I have a windows forms app, in which I am trying to connect to Oracle 11g DB with OracleManaged driver, which ends with an exception "ORA-12154: TNS:could not resolve the connect identifier specified". However when I am trying to connect through ODP.NET 64bit dlls, it is connecting (for this I ensured building the app in x64). The sample code below. If I toggle to second statement, I am getting the error while opening the connection.
Oracle.DataAccess.Client.OracleConnection con = new Oracle.DataAccess.Client.OracleConnection();
//Oracle.ManagedDataAccess.Client.OracleConnection con = new Oracle.ManagedDataAccess.Client.OracleConnection();
con.ConnectionString = "Data Source=v3;User Id=xxx;Password=xxx;";
con.Open();
MessageBox.Show("Done");
con.Close();
Is there a setting I am missing? Even I tried with the configure.bat that came along with manaed ODP (64bit)
The reason is simple, your managed driver does not know where to find the TNSNAMES.ORA. Oracle says it depends on environment variables.
What we do here is to set TNS_ADMIN environment variable to the folder containing the TNSNAMES and everything works perfectly.
This is the best solution since it allows you not having multiple instances of TNSNAMES.ora on your station...
I got this worked by copying the tnsnames.ora file to bin folder. It seems like the managed driver couldn't find the right tnsname.ora file.

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