Connection to Oracle DB with Play Framework failed - oracle

I have this exception when I am trying to connect my oracle database to my application on Play! Framework 2.1.5 (the problem concerns the ebean.default="models.*" line) :
Configuration error
path parameter: Invalid path ' - could not find datasource for default': Token not allowed in path expression: '-' (Invalid number: '-') (you can double-quote this token if you really want it here)
In C:\MyApps\oracleCrud2\conf\application.conf at line 54.
51# You can declare as many Ebean servers as you want.
52# By convention, the default server is named `default`
53#
54 ebean.default="models.*"
55
56# Logger
57# ~~~~~
58# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
Some help would be appreciated :)

I am answering my own question. Here is the working part of the application.conf that deals with Oracle connection with Play! :
db.default.driver=oracle.jdbc.driver.OracleDriver
db.default.url="jdbc:oracle:thin:#//127.0.0.1:1521/xe"
db.default.user=play
db.default.password=play
Hope that I helped, have a good one !
-Ramzi

Related

Connecting a db2 database from a centos hosted laravel application

I'm trying to connect to a db2 database server (iseries ibm) from my laravel application (5.8). The application is running on a centos linux server.
I saw that db2 isn't in the 4 databases types listed here : https://laravel.com/docs/5.8/database#introduction.
So I tried to use that package https://github.com/cooperl22/laravel-db2 but I got the followings errors :
Undefined class constant 'I5_ATTR_DBC_SYS_NAMING'
And I've got the errors for 5 constants :
PDO::I5_ATTR_DBC_SYS_NAMING, PDO::I5_ATTR_COMMIT, PDO::I5_ATTR_JOB_SORT, PDO::I5_ATTR_DBC_LIBL, PDO::I5_ATTR_DBC_CURLIB.
Also, if I comment theses constants, I got this error :
`Syntax error: -104 [IBM][CLI Driver][AS] SQL0104N An unexpected token "<END-OF-STATEMENT>" was found following "". Expected tokens may include: "( + - ? : DAY INF NAN RID ROW RRN". SQLSTATE=42601 (SQLNumResultCols[-104] at /root/PDO_IBM-1.3.6/ibm_driver.c:153) (SQL: select * from )`
I'm using the db2_ibmi_ibm driver.
Here is my php info linked to the driver :
EDITED :
php version is 7.3.4
centos version is 7
Also I made a from scratch php script running and I can get the results from a query using the db2_connection method. So I'm pretty sure it's PDO related :-/
Ok I found the issue, my scheme and database were wrong, so the query wasn't correct.
The PDO constants are not needed in my case.
Thanks for your answers

Error on installing Titan DB on Windows

Following the official guide of Titan DB here, and trying to run the command:
graph = TitanFactory.open('conf/titan-cassandra-es.properties')
I got this error:
Backend shorthand unknown: conf/titan-cassandra-es.properties
Obviously, the reason is the incorrect path to the
titan-cassandra-es.properties
file. So I changed it to:
graph = TitanFactory.open('../conf/titan-cassandra-es.properties')
and got this error:
Encountered unregistered class ID: 141.
The error happens in the following version:
titan-0.5.4-hadoop2
On titan-1.0.0-hadoop2 instead of this error message I get this one:
Invalid import definition: 'com.thinkaurelius.titan.hadoop.MapReduceIndexManagement'; reason: startup failed: script14747941661821834264593.groovy: 1: unable to resolve class com.thinkaurelius.titan.hadoop.MapReduceIndexManagement # line 1, column 1. import com.thinkaurelius.titan.hadoop.MapReduceIndexManagement ^
1 error
And on titan-1.0.0-hadoop2 I get this one:
The input line is too long.
The syntax of the command is incorrect.
Does anyone know how to handle this issue?
It seems like you have not even managed to get Titan 1 to start up yet.
I do not believe Titan 1 has been deployed to support Windows out of the box. I.e. the downloadable package will not just work with windows.
Saying that I have managed to get Titan DB 1 to work on windows. To do so, all you have to do is install Cassandra 2.x on Windows. This guide may help you out. Start cassandra and enable thrift connections.
With that done you should be able to get Titan doing basic operations on windows. From there you may find dealing with you current errors easier.
Side Note: Windows support for Titan 0.5.x may be more substantial. So you could look into that as well.

Spring Boot Actuator Liquibase endpoint fail

I'm trying to use Liquibase with Spring Boot.
Here is my application.properties file:
# ----------------------------------------
# DATA PROPERTIES
# ----------------------------------------
spring.datasource.url=jdbc:postgresql://xxxxxx:5432/dev
spring.datasource.schema=my_schema
spring.datasource.username=my_username
spring.datasource.password=my_password
# LIQUIBASE (LiquibaseProperties)
liquibase.default-schema=${spring.datasource.schema}
liquibase.user=${spring.datasource.username}
liquibase.password=${spring.datasource.password}
Change sets are well applied (table creation is ok).
The problem comes when I access /liquibase actuator's endpoint, I get a 500 error:
Unable to get Liquibase changelog
I also get the following log:
org.postgresql.util.PSQLException: ERROR: relation "public.databasechangelog" does not exist
If thing the problem is the schema prefix used to access changelog table: "public" versus "my_schema".
I thought spring.datasource.schema was the right parameter to set ?
Here is a working solution (come from this answer):
# ----------------------------------------
# DATA PROPERTIES
# ----------------------------------------
spring.datasource.url=jdbc:postgresql://xxxxxx:5432/dev?currentSchema=my_schema
Just a guess here - I think that the issue is that your 'real' schema is being set by the spring.datasource.schema but the liquibase tables are being stored in public and it may be that the Spring Boot actuator doesn't know that those can be separate.

Hibernate seems not to resolve alias correctly

since some days I'm facing the following problem:
I am using Hibernate to do the following Restriction on a criteria:
...
criteria.add(Restrictions.sqlRestriction("1=1 CONNECT BY PRIOR {ProcessEntityworkflowProject}.ID = {ProcessEntityworkflowProject}.PARENT_ID"))
Where "ProcessEntityworkflowProject" is the alias which should be resolved by hibernate.
This alias is set in code properly. I also debugged the code and inspected criteria:
There I could see that a subcriteria in subcriterialist of criteria has this correct alias bound to the association path.
But in SQL logs I see that it is not resolved:
... and this_.EXTERNAL_KEY is not null and 1=1 CONNECT BY PRIOR {ProcessEntityworkflowProject}.ID = {ProcessEntityworkflowProject}.PARENT_ID and processent4_.TYPE_ID=? ...
... or is this output correct and it is resolved later internally?
And in tomcat.log I see that there is a NPE:
java.lang.NullPointerException
at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.java:876)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:831)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:850)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3384)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:295)
I already found out that this NPE is cause because Oracle JDBC driver can not parse the brackets "{" "}". So I guess that the alias was not resolved properly.
Does anyone of you have an idea what could be wrong or how I could investigate deeper?
Some additional info:
I am using Hibernate 3.2.0 (CR1 afaik), tomcat 5.5, ojdbc14.jar.
Running on RHEL 6.4 and Oracle 11g
Many thx in advance if some of you have an idea ;)
Cheers
Sascha

Trouble getting jConnect3 working with Sybase IQ in struts2

I am trying to get jconn3.jar driver to connec to Sybase IQ in a struts app. Here is my config file:
<jdbc-driver-params>
<url>jdbc:sybase:Tds://myhost:2641/LDW</url>
<driver-name>com.sybase.jdbc3.jdbc.SybDriver</driver-name>
<properties>
.
.
.
Unfortunately, this is what the log says:
<Creating Connection Pool named jConnectLDW, URL = jdbc:sybase:Tds://myhost:2641/LDW, Properties = user=myUsername;hostname=foo;.>
<registerDriver: driver[className=com.sybase.jdbc3.jdbc.SybDriver,com.sybase.jdbc3.jdbc.SybDriver#1092d6d2]>
<java.sql.SQLException: JZ003: Incorrect URL format. URL:
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
I have done quite a bit of hunting and I cannot see a problem with the URL. Can anyone spot a problem here?
You do have the wrong URL in your code.
In the examples the URL is shown as jdbc:sybase:Tds:host:port with examples like jdbc:sybase:Tds:myserver:3767
In these cases the host is just the name of the machine and has no path separators (i.e. the \ or /) so try jdbc:sybase:Tds:myhost:2641/LDW

Resources