Failed to connect to localhost orientdb using jdbc - orientdb

I'm using OrientDB 2.1.9 and has created plocal graph database called 'TimespentEvents'.
When trying to connect from Java using JDBC driver in the same machine with URL 'jdbc:orient:remote:localhost/TimespentEvents' and user/password admin/admin I encounter the following exception:
Caused by: com.orientechnologies.orient.core.exception.OConfigurationException: Error on opening database: the engine 'remote' was not found. URL was: remote:localhost/TimespentEvents. Registered engines are: [plocal, memory]
When changing the URL into 'jdbc:orient:plocal:TimespentEvents' the error turns into:
Caused by: com.orientechnologies.orient.core.exception.OStorageException: Cannot open the storage 'TimespentEvents' because it does not exist in path: localhost/TimespentEvents
Below is the jdbc driver jars I include in the classpath:
orientdb-jdbc-2.1.9.jar
orientdb-core-2.1.9.jar
Any help would be greatly appreciated.
Thanks & Regards,
Setya

Turns out I have to include 2 additional jars:
orientdb-enterprise-2.1.9.jar
orientdb-client-2.1.9.jar
Thanks & Regards,
Setya

Related

java.lang.RuntimeException: Failed to resolve Oracle database version

I am using debezium oracle connector in kafka connect.While starting connector I am getting below error,
java.lang.RuntimeException: Failed to resolve Oracle database version
at io.debezium.connector.oracle.OracleConnection.resolveOracleDatabaseVersion(OracleConnection.java:159)
at io.debezium.connector.oracle.OracleConnection.<init>(OracleConnection.java:71)
at io.debezium.connector.oracle.OracleConnector.validateConnection(OracleConnector.java:74)
at io.debezium.connector.common.RelationalBaseSourceConnector.validate(RelationalBaseSourceConnector.java:52)
at org.apache.kafka.connect.runtime.AbstractHerder.validateConnectorConfig(AbstractHerder.java:400)
at org.apache.kafka.connect.runtime.AbstractHerder.lambda$validateConnectorConfig$2(AbstractHerder.java:351)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:#**.**.*.**:1521/CDB
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$0(JdbcConnection.java:184)
at io.debezium.jdbc.JdbcConnection$ConnectionFactoryDecorator.connect(JdbcConnection.java:121)
at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:890)
at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:885)
at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:643)
at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:517)
at io.debezium.connector.oracle.OracleConnection.resolveOracleDatabaseVersion(OracleConnection.java:129)
... 10 more
I am refering to the link for oracle setup and connector configuration,
**https://debezium.io/documentation/reference/connectors/oracle.html#setting-up-oracle**
connector-configuration.properties
name=debeziumoraclesource
connector.class=io.debezium.connector.oracle.OracleConnector
database.hostname=**.*.**.**
database.port=1521
database.user=username
database.password=password
database.dbname=CDBNAME
database.server.name=**.*.**.**
tasks.max=1
database.pdb.name=PDBNAME
database.history.kafka.bootstrap.servers=kafka:9092
database.history.kafka.topic=history.ENTITY_GROUP_PARAMETER_VALUES
database.connection.adaptor=logminer
snapshot.mode=initial
table.include.list=schema.ENTITY_GROUP_PARAMETER_VALUES
Also I have download ojdbc8.jar and placed inside kafka/libs folder.I have tried using different version of jars like ojdbc10 and different versions of ojdbc8.Nothing helped me.Also to the point of note I am using oracle19c.Please help me in resolving this issue.Thanks in advance.
Using OJDBC6.jar with all dependencies helped me to resolve the issue. And most importantly i placed the jars in connectors lib folder.
Using OJDBC8.jar helped me solve the problem, the problem appeared as I didn't place the jar on all the servers that were running kafka connect.

How do I install google cloud jdbc driver manually for the flyway cli?

Looking at this reference: https://docs.kony.com/konylibrary/konyfabric/kony_fabric_manual_install_guide/Content/FlywayNew.htm
It says the Google Cloud SQL drivers need to be installed manually for the flyway cli, but how do I install them manually? I can't find any documentation on it.
EDIT:
I added this to my flyway.conf: flyway.jarDirs=/Users/my/flyway
Then I downloaded the driver into that folder:
mvn dependency:get -Ddest=/Users/my/flyway -Dartifact=com.google.cloud.sql:postgres-socket-factory:1.3.0
but when I try to use it I get this error:
The SocketFactory class provided com.google.cloud.sql.postgres.SocketFactory could not be instantiated.
EDIT: this is the debug output when running flyway baseline against my DB
Flyway Community Edition 7.10.0 by Redgate
DEBUG: AWS SDK available: false
DEBUG: Google Cloud Storage available: true
DEBUG: Scanning for filesystem resources at 'sql'
ERROR: Skipping filesystem location:sql (not found).
ERROR: Unexpected error
org.flywaydb.core.internal.exception.FlywaySqlException:
Unable to obtain connection from database (jdbc:postgresql:///mydb ?unixSocketPath=/var/run/cloudsql/ &cloudSqlInstance=my-gcp-project:us-central1:my-cloudsql-instance &socketFactory=com.google.cloud.sql.postgres.SocketFactory &user=jenkins-flyway &password=******************************************) for user 'null': The SocketFactory class provided com.google.cloud.sql.postgres.SocketFactory could not be instantiated.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State : 08006
Error Code : 0
Message : The SocketFactory class provided com.google.cloud.sql.postgres.SocketFactory could not be instantiated.
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:71)
at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:68)
at org.flywaydb.core.Flyway.execute(Flyway.java:510)
at org.flywaydb.core.Flyway.baseline(Flyway.java:406)
at org.flywaydb.commandline.Main.executeOperation(Main.java:226)
at org.flywaydb.commandline.Main.main(Main.java:149)
Caused by: org.postgresql.util.PSQLException: The SocketFactory class provided com.google.cloud.sql.postgres.SocketFactory could not be instantiated.
at org.postgresql.core.SocketFactoryFactory.getSocketFactory(SocketFactoryFactory.java:43)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:182)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:223)
at org.postgresql.Driver.makeConnection(Driver.java:465)
at org.postgresql.Driver.connect(Driver.java:264)
at org.flywaydb.core.internal.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:268)
at org.flywaydb.core.internal.jdbc.DriverDataSource.getConnection(DriverDataSource.java:232)
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:55)
... 5 more
Caused by: java.lang.ClassNotFoundException: com.google.cloud.sql.postgres.SocketFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at org.postgresql.util.ObjectFactory.instantiate(ObjectFactory.java:46)
at org.postgresql.core.SocketFactoryFactory.getSocketFactory(SocketFactoryFactory.java:39)
... 13 more
This is for Postgres on Google Cloud, yes?
The intention is that you put driver JARs into the drivers folder inside the Flyway product (not 100% sure for v4.0 as that's very elderly now - 7.11 is current). jarDirs should work, but it's the intended place for Java-based migrations.
However, it looks like a problem within the driver. Are you making sure to put all dependencies of the driver there too? Could you provide a full debug log (that is, flyway migrate -X) with exception details so we could take a look?
EDIT: It's definitely a problem within the driver, looking at that debug log - it's not able to instantiate a class internal to the driver.

How to configure PostgreSQL database for deploying alfresco on tomcat 8?

I have built alfresco(version 5.2) from source on ubuntu 16.04. I want to deploy alfresco on tomcat 8. The deployment is successful however the PostgreSQL database is not getting configured as required. I have followed the steps as given in http://docs.alfresco.com/5.1/tasks/postgresql-config.html
I observe the home page as given in image alfresco_page
Am I missing onto something here that the PostgreSQL database is not getting configured. Is there any other configuration that needs to be done that I have missed ?
UPDATE
The alfresco.log gave me this
2017-08-01 05:53:54,406 WARN [org.alfresco.web.scripts.servlet.X509ServletFilterBase] [localhost-startStop-1] clientAuth does not appear to be set for Tomcat. clientAuth must be set to 'want' for X509 Authentication
2017-08-01 05:53:54,416 WARN [org.alfresco.web.scripts.servlet.X509ServletFilterBase] [localhost-startStop-1] Attempting to set clientAuth=want through JMX...
2017-08-01 05:53:54,427 WARN [org.alfresco.web.scripts.servlet.X509ServletFilterBase] [localhost-startStop-1] Unable to set clientAuth=want through JMX.
2017-08-01 05:53:55,139 ERROR [org.apache.solr.core.CoreContainer] [coreLoadExecutor-5-thread-1] Error creating core [collection1]: Could not load conf for core collection1: Error loading solr config from solr/collection1/conf/solrconfig.xml
org.apache.solr.common.SolrException: Could not load conf for core collection1: Error loading solr config from solr/collection1/conf/solrconfig.xml
at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:66)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:489)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:255)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:249)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.solr.common.SolrException: Error loading solr config from solr/collection1/conf/solrconfig.xml
at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:154)
at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:80)
at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:61)
... 7 more
Caused by: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or '/root/tomcat85/output/build/webapps/solr/collection1/conf'
at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:362)
at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:308)
at org.apache.solr.core.Config.<init>(Config.java:117)
at org.apache.solr.core.Config.<init>(Config.java:87)
at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:167)
at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:145)
... 9 more
2017-08-01 05:54:09,634 WARN [org.hibernate.cfg.SettingsFactory] [localhost-startStop-1] Could not obtain connection metadata
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2079)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1304)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:863)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:782)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
Things to check:
Is postgres running (ps -ef|grep postgres)?
Can you use psql to connect to postgres using the db.name, db.username, and db.password that are configured in alfresco-global.properties?
Did you follow the step in the docs about editing pg_hba.conf to make sure that postgres is configured to allow password based authentication?
Also, it is exceedingly rare to need to build Alfresco from source unless you are making changes to the low-level classes themselves, which is not recommended.

Can't find suitable driver

I have a simple application that uses hibernate to work with db. When i check connection and some methods in main method, everything is fine. But when i deploy it on server, it throws
javax.servlet.ServletException: Cant instantiate class: managed.ClientsBean.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
root cause:
com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: managed.ClientsBean.
...
root cause:
javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
...
root cause:
org.hibernate.exception.JDBCConnectionException: Could not open connection
root cause
java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/project
But I have that driver, in jboss\standalone\deployments too. How can I make jboss see it?
See here:
https://community.jboss.org/wiki/DataSourceConfigurationInAS7
And here
JDBC Postgresql driver on JBoss 7

No Suitable Driver found for JDBC-Postgresql

I am building a project using "Maven".
In the Pom.xml i have added dependency for Postgresql and it is downloaded (as required) and is present in the Project's libs/ folder.
Now i have made a connection to it in my java file as follows :
static String userid="postgres", password = "myPassword";
static String url = "jdbc:postgresql:coredb_jfeed6";
static Connection con;
con = DriverManager.getConnection(url,userid, password);
Where "coredb_jfeed6" is my database name.
There is no compile time error. But at runtime it produces the following error :
Exception stack is:
1. No suitable driver found for jdbc:postgresql:coredb_jfeed6 (java.sql.SQLException)
java.sql.DriverManager:640 (null)
Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver found for jdbc:postgresql:coredb_jfeed6
(org.springframework.jdbc.CannotGetJdbcConnectionException)
org.springframework.jdbc.datasource.DataSourceUtils:80 (null)
Root Exception stack trace:
java.sql.SQLException: No suitable driver found for jdbc:postgresql:coredb_jfeed6
at java.sql.DriverManager.getConnection(DriverManager.java:640)
at java.sql.DriverManager.getConnection(DriverManager.java:169)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)
Could anyone please help me regarding this.?
Ok. I figured it out.
Its a BUG in Mule 3.1.2.
Its like "When an external library is to be searched, then Mule looks it in projects/lib folder. But this does not hold true for All the Database related Libraries like postgresql library" . So we need to put it in mule/user/lib folder for it to Work Correctly.