oracle sql developer connection error - java

I can't get the connection to work for Oracle WebLogic 12c using SQL Developer. Here is the error that I get when I click connect:
An error was encountered performing the requested operation:
/usr/lib/java/libocijdbc11.dylib: dlopen(/usr/lib/java/libocijdbc11.dylib, 1): Library not loaded: /ade/b/2475221476/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /usr/lib/java/libocijdbc11.dylib
Reason: image not found
Vendor code 0
When I click Test in the Settings of SQL Developer I get the following log:
Testing the Instant Client located at /usr/lib/java
Testing client directory ... OK
Testing loading Oracle JDBC driver ... OK
Testing checking Oracle JDBC driver version ... OK
Driver version: 11.2.0.3.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 DYLD_LIBRARY_PATH.
Check it to verify that the expected native library
directory /usr/lib/java is present and precedes any other client installations.
java.library.path = /Users/gasim/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Here is an outline of my setup:
Operating system: OSX Mavericks (10.9.4 to be specific)
The Java SE Runtime version: "1.8.0" (build "1.8.0_11-b12")
Oracle Instant is located under /usr/lib/java. The directory is set in the SQL Developer (through Database > Advanced)
The Oracle server is up and running with default parameters (localhost:7001) and I can access the web admin console.
Oracle Instant Client version: 11.2.0.4.0
java.library.path = /Users/gasim/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
The directory listing of /usr/lib/java:
BASIC_README
adrci
genezi
libclntsh.dylib.11.1
libnnz11.dylib
libocci.dylib.11.1
libociei.dylib
libocijdbc11.dylib
ojdbc5.jar
ojdbc6.jar
uidrvci
xstreams.jar
The thing is, libocijdbc11.dylib does exist in /usr/lib/java and that directory is in the library path of java. I just don't get it. Am I missing something here? What else can I try for solving this problem or at least debugging deeper?

I'll tell you how I solved, finally...
I'm running OSX 10.9.4, with jboss 7.1.1.Final installed through brew, and an env variable JBOSS_HOME=/usr/local/opt/jboss-as/libexec.
I already had an ojdbc.jar in $JBOSS_HOME/modules/com/oracle/main, version 11.2.0.3, so I downloaded Instant Client version 11.2.0.3.
I commented any JAVA_OPTS that was populating java.library.path with instantclient libraries, like this:
#JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$JBOSS_HOME/instantclient_11_2"
I copied, for being comfortable, instantclient_11_2 inside $JBOSS_HOME.
It's just a matter of doing:
export DYLD_LIBRARY_PATH=$JBOSS_HOME/instantclient_11_2
$JBOSS_HOME/bin/standalone.sh
It now works. Now I have another problem to solve:
Native Library /usr/local/Cellar/jboss-as/7.1.1.Final/libexec/instantclient_11_2/libocijdbc11.dylib already loaded in another classloader

Related

Macbook Pro M1 issues connecting to oracle database with R

I am using an M1 MBP running Monterey and trying to connect to an oracle database to pull data into R. Currently I am trying to setup RJDBC but am open to other options if there is something easier to use.
When I try to load RJDBC I am getting:
Loading required package: rJava
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(jli, FALSE)
error: unable to load shared object '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib':
dlopen(/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib, 0x000A): tried: '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libjli.dylib' (no such file)
Error: package ‘rJava’ could not be loaded
I have seen a few similar posts:
How to install rJava package in Mac with M1 architecture
Problem with R studio on Mac with Monterey and arm system
And am wondering what the best course of action here is. Would it be better to try and instal the arm version of java or the arm version of R?
JavaAppletPlugin no longer exists.
Java Applet technology has been retired, phased out across all platforms including macOS.
See Oracle white paper, Java Client Roadmap Update.
Contact the app publisher for an updated modern release. The release you have must be from many years ago.
Resolved by downloading ARM version of java:
https://www.oracle.com/java/technologies/downloads/#jdk17-mac

Ojdbc10 and jdk12

I am trying to connect to Oracle database Express Edition (XE) Release 18.4.0.0.0 with my application that uses jdk12.
I am using ojdbc10 as an external jar and getting the following error:
java.lang.RuntimeException: Failed to load class of driverClassName [oracle.jdbc.driver.OracleDriver] in either of HikariConfig class loader or Thread context classloader
My ojdbc10.jar is in classpath (it gets loaded in the application). And Oracle official website only states that ojdbc10 is certified with jdk10 and it doesn't say anything
about jdk12.
Does anyone have any ideas about what might be causing this?
Is there any way I can make ojdbc to work with jdk12 because I cannot downgrade jdk?
It is strange.
ojdbc10 is meant for Java JVM 10. That's all you can get from JDBC driver file name.
The rest of information(JDBC ver, DB ver) you get by "executing" the driver.
$ java -jar ojdbc6.jar
Oracle 11.2.0.4.0 JDBC 4.0 compiled with JDK6 on Thu_Jul_03_18:17:32_PDT_2014
#Default Connection Properties Resource
#Wed Jul 15 11:33:31 GMT 2020
In your case the problem has to be something else. JVM 12 should be able to load Java 10 jars.
Also IMHO Java 12 did not introduce any newer JDBC standard update(still on ver JDBC 4.3), so there will not be any ojdbc12.jar driver file - because JDBC version implementation is what really matters.

SQLException: this driver is not configured for integrated authentication tomcat

Am trying to connect MS SQL server through java web applications.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection= DriverManager.getConnection("jdbc:sqlserver://localhost;databaseName=XXX;integratedSecurity=true");
I have copied "sqljdbc_auth.dll" to $Tomcat_home/bin and copied jar into $Tomcat_home/lib folder.
I Have multiple web apps in same tomcat instance.
The first webApp loads and successfully establishes the connection with MS SQL.
But the remaining apps fail to connect to MS SQL prompting:
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:41d72756-1383-427e-8c4f-c3075ae1559a
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2400)
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<init>(AuthenticationJNI.java:68)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3132)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:43)
Note: Tomcat runs as windows service. And MSSQL is configured to windows authentication.
edit:
I understand that the native library (DLL) can only be loaded into the JVM once, hence the error, but I after looking around the net I still have no solution.
sqljdbc_auth.dll is need to use windows authentication or Kerberos authentication.
Get the dll from Microsoft and install it either by:
drop on application library folder
drop on the java bin folder.
Not recommended if you want to package the applications with all the
dependencies. Also, it requires to find what java version is being
used and from what path.
drop the library on some folder and then add the path in the command line:
java -Djava.library.path=<library path>...
The mssql-jdbc driver and the sqljdbc_auth.dll should be:
on the same folder
both from the same version
for the same architecture (x86/x64) JVM is running.
Check also the jdbc comparability matrix with java versions.
The JDBC driver supports the use of Type 2 integrated authentication on Windows operating systems through the integratedSecurity connection string property. To use integrated authentication, copy the sqljdbc_auth.dll file to a directory on the Windows system path on the computer where the JDBC driver is installed.
Alternatively you can set the java.libary.path system property to specify the directory of the sqljdbc_auth.dll. For example, if the JDBC driver is installed in the default directory, you can specify the location of the DLL by using the following virtual machine (VM) argument when the Java application is started:
-Djava.library.path=c:/sqljdbc_<version>/enu/auth/x86
or
-Djava.library.path=c:/sqljdbc_<version>/enu/auth/x64
Please read more about in the original documentation:
https://learn.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-2017
In order to be able to connect with the JDBC, you need to define the connection as follows:
"jdbc:sqlserver://*******
;authenticationScheme=NTLM;integratedSecurity=true;domain=******
****;databasename=**********;encrypt =
true;trustServerCertificate=true;user=*******;password=*******;"
Use the following dependency:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>10.2.0.jre8</version>
</dependency>

JDBC with MSSQL on tomcat7 catalina

I am trying to configure activiti to communicate ms-sql 2014 with windows authentication instead of with username/password in connection url.
What i have done ?
downloaded JDBC Driver, put sqljdbc4-3-0.jar in JAVA_HOME and in the web-info\lib
put sqljdbc_auth.dll (64bit) in C:\Windows\System32
set integrated security in db.properties as following:
db.properties (C:\Workflow\apache-tomcat-7.0.62\webapps\activiti-explorer\WEB-INF\classes):
db=mssql
jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://127.0.0.1:1433;databaseName=activiti;integratedSecurity=true;
When using regular authentication (I remove the integratedSecurity=true and add user=XXX and password=XXX it works!)
When I open log the last line is:
DEBUG org.springframework.jdbc.datasource.SimpleDriverDataSource: Creating new JDBC Driver Connection to [jdbc:sqlserver://localhost;databaseName=activiti;integratedSecurity=true;]
Then the java application shutsdown and i see hs_err_pid4232.log as attached with exception:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000061a3cf13, pid=4232, tid=8080
What can cause this not to work ?
I want thinking maybe it did not load the DLL/JARS it should be in order to use JDBC driver ? the sql server config looks like this:
The log of process crush is at: http://pastebin.com/xpW5yvEP
This error screams "trouble with the authentication dll". Try these steps:
Download latest sqljdbc, unzip it locally from here: https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
put the .jar in your classpath and the .dll in your library path. Try using a "real" path by adding -Djava.library.path=PATH/TO/DLL into your startup.
run java -fullversion to make sure you have the right .dll (32 bit vs 64 bit) installed there.
run program again.

How to add mysql connector to Sqoop 1.99.3

I have installed Hadoop & connected with Hadoop locally successful. I can connect the Sqoop via REST api and via cli interface.
But once I want to start creating a job for important data from MySQL. It shows
Connection configuration Warning message: Can't connect to the
database with given credentials: No suitable driver found for
jdbc:mysql://127.0.0.1:3306/for
Error message: Can't load specified driver
after google its solution, I has already
put the mysql-connector.jar to sqoop web lib folder
create a lib folder under the sqoop folder and put the mysql-connector.jar in it
I also have restarted or even reboot my VM. It still says cannot load specified driver.
Is there any config files I have missed to set? Thank you!
My ENV:
VirtualBox + Vagrant + Ubuntu 12.04
JDK (Sun Distrubution 1.7_update 51)
Hadoop 2.2.0 (complied version)
Sqoop 1.99.3 (complied version)
Thank again!
check your 'JDBC Driver Class' of the connection you just created in sqoop,it should be setted
as com.mysql.jdbc.Driver.
If still not work,put mysql-connector-java-3.1.12-bin.jar into $SQOOP_HOME/server/lib

Categories

Resources