Connection of NEO4J TO Oracle Database - oracle

I am trying to run 👍
call apoc.load.driver('oracle.jdbc.driver.OracleDriver');
in neo4j to load oracle driver but i am getting below error
Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke
procedure apoc.load.driver: Caused by: java.lang.RuntimeException:
Could not load driver class oracle.jdbc.driver.OracleDriver
oracle.jdbc.driver.OracleDriver
I have placed the jdbc and apoc in plugins and i am able to apoc.load.driver procedure on command prompt .
Please help me with the issue

Related

Connecting Oracle DB from PySpark 3.1.2 - fails with Py4JJavaError

I am trying out PySpark3.2.1 with Oracle 11G. It fails with the following error:
Py4JJavaError: An error occurred while calling o44.load.
: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
My code:
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("PySpark_Oracle_Connection").getOrCreate()
driver = 'oracle.jdbc.OracleDriver'
url = 'jdbc:oracle:thin:#hostname:port/dbTEST'
user = 'myname'
password = 'mypswd'
table = 'mytable'
SPARK_CLASS_PATH = "C:\Oracle_Client\jdbc\lib\ojdbc8.jar"
df = spark.read.format('jdbc')\
.option('driver', driver)\
.option('url', url)\
.option('dbtable', table)\
.option('user',user)\
.option('password',password).load()
I'd appreciate a quick help, please. I have gone through previous posts, but still doesn't work.
Py4JJavaError: An error occurred while calling o44.load.
: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
Error itself suggests the problem root cause i.e. oracle.jdbc.OracleDriver class was not found when spark tried to read from your oracle db table.
So now, you just have to tell the spark to find your jar. This can be done by changing spark-defaults.conf file which should be present in the $SPARK_HOME/conf/ directory. If not present, then add it yourself with the following config:
spark.driver.extraClassPath C:\Oracle_Client\jdbc\lib\ojdbc8.jar
spark.executor.extraClassPath C:\Oracle_Client\jdbc\lib\ojdbc8.jar
Or just use the --jars option while submitting the job.
driver = 'oracle.jdbc.OracleDriver'
is the old version with ojdbc8.jar you must use
driver= 'oracle.jdbc.driver.OracleDriver'

Beginner query: Cannot start Gremlin Server on Windows

I am new to graph databases and I am trying to start the Gremlin Server using the command: bin\gremlin-server.bat
But, I am getting this error:
Error: Could not find or load main class
org.apache.tinkerpop.gremlin.server.GremlinServer
Caused by: java.lang.ClassNotFoundException: org.apache.tinkerpop.gremlin.server.GremlinServer
NOTE: -i is deprecated. Please update your scripts. Using 'install' command...
Error: Could not find or load main class org.apache.tinkerpop.gremlin.server.util.GremlinServerInstall
Caused by: java.lang.ClassNotFoundException: org.apache.tinkerpop.gremlin.server.util.GremlinServerInstall
Can anyone help me with this ?

Oracle Database connection in play framework 2.5.10

I am unable to connect the oracle database in play framework.
Steps I followed as below:
configuration of database in application.conf file as below:
default.driver=oracle.jdbc.driver.OracleDriver
default.url="jdbc:oracle:thin:#localhost:1521:XE"
default.username=username
default.password=password
->added ojdbc14.jar in lib folder in the project
while hitting the browser with url http://localhost:9000
I am getting below error:
Cannot connect to database [default]
exception is as below on console:
[error] c.z.h.p.PoolBase - HikariPool-1 - Failed to execute isValid() for connection, configure connection test query. (oracle.jdbc.driver.T4CConnection.isValid(I)Z)
[info] application - Creating Pool for datasource 'default'
[error] c.z.h.p.PoolBase - HikariPool-2 - Failed to execute isValid() for connection, configure connection test query. (oracle.jdbc.driver.T4CConnection.isValid(I)Z)
[error] application -
! #738nhifg4 - Internal server error, for (GET)
play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
at play.api.Configuration$.configError(Configuration.scala:154)
at play.api.Configuration.reportError(Configuration.scala:806)
at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:48)
at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:42)
at scala.collection.immutable.List.foreach(List.scala:381)
at play.api.db.DefaultDBApi.connect(DefaultDBApi.scala:42)
at play.api.db.DBApiProvider.get$lzycompute(DBModule.scala:72)
at play.api.db.DBApiProvider.get(DBModule.scala:62)
at play.api.db.DBApiProvider.get(DBModule.scala:58)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
Caused by: play.api.Configuration$$anon$1: Configuration error[Failed to initialize pool: oracle.jdbc.driver.T4CConnection.isValid(I)Z]
at play.api.Configuration$.configError(Configuration.scala:154)
at play.api.PlayConfig.reportError(Configuration.scala:996)
at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:70)
at play.api.db.PooledDatabase.createDataSource(Databases.scala:199)
at play.api.db.DefaultDatabase.dataSource$lzycompute(Databases.scala:123)
at play.api.db.DefaultDatabase.dataSource(Databases.scala:121)
at play.api.db.DefaultDatabase.getConnection(Databases.scala:142)
at play.api.db.DefaultDatabase.getConnection(Databases.scala:138)
at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:44)
at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:42)
Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: oracle.jdbc.driver.T4CConnection.isValid(I)Z
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:512)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:105)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71)
at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:58)
at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:54)
at scala.util.Try$.apply(Try.scala:192)
at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:54)
at play.api.db.PooledDatabase.createDataSource(Databases.scala:199)
at play.api.db.DefaultDatabase.dataSource$lzycompute(Databases.scala:123)
at play.api.db.DefaultDatabase.dataSource(Databases.scala:121)
Caused by: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
at com.zaxxer.hikari.pool.PoolBase.checkDriverSupport(PoolBase.java:400)
at com.zaxxer.hikari.pool.PoolBase.setupConnection(PoolBase.java:375)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:346)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:506)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:105)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71)
at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:58)
at play.api.db.HikariCPConnectionPool$$anonfun$1.appl`enter code here`y(HikariCPModule.scala:54)
at scala.util.Try$.apply(Try.scala:192)
at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:54)
any advice will be appreciated.
Essentially, the problem is Oracle connectivity with ojdbc14.jar is not supported by Play Framework.
I tried with ojdbc6 for Oracle 11g and it worked.

Squirrel Setup to connect to Phoenix - HBASE: Error java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NoSuchMethodError:

I am a newbie to Hbase & phoenix. I am trying to connect to HBASE via Phoenix JDBC Driver using Squirrel Client. Somehow I seem to get a strange error where the runtime complains of a NoSuchMethod Exception. I have included the relevant client jar phoenix-4.4.0-HBase-1.0-client in the lib folder of Squirrel and have registered the driver succesfully. When I try to connect I get this exception which seems to be a bit weird. I have xtracted the jar and seen that indeed the method getCurrentUser() exists in the org/apache/hadoop/security/UserGroupInformation.class file.
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.apache.hadoop.security.UserGroupInformation.getCurrentUser()Lorg/apache/hadoop/security/UserGroupInformation;
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:202)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.awaitConnection(OpenConnectionCommand.java:132)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$100(OpenConnectionCommand.java:45)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$2.run(OpenConnectionCommand.java:115)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
I finally uncovered it. The hadoop-0.20.2-core.jar and phoenix-4.4.0-HBase-1.0-client.jar have common overlapping classes, which were in the lib folder of the Squirrel client. hadoop-0.20.2-core.jar is required to connect to hive where as phoenix client jar is required to connect to hbase.
Whenever I need to connect to one or the other I have to exclude one of these from the lib folder while launching squirrel client.

Connect to Oracle using Slick

I am trying to connect to Oracle using Slick.
I got the slick-extensions_2.10-1.0.0.jar.
Added the line below in Scala
Database.forURL("jdbc:oracle:thin:#myhost:myport:dbalias", "myid", "mypwd", null, driver =
"com.typesafe.slick.driver.oracle.OracleDriver") withSession {.......}
What is the right URL to use for this driver since I got the following error:
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:#myhost:myport:dbalias
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at scala.slick.session.Database$$anon$2.createConnection(Database.scala:105)
at scala.slick.session.BaseSession.conn$lzycompute(Session.scala:207)
at scala.slick.session.BaseSession.conn(Session.scala:207)
at scala.slick.session.BaseSession.close(Session.scala:221)
at scala.slick.session.Database.withSession(Database.scala:38)
at scala.slick.session.Database.withSession(Database.scala:46)
It seems you did not make the oracle jdbc driver available in classpath when running your program.

Resources