Pentaho Kettle Invalid JNDI connection Could not create connection to database server - pentaho

I was using JNDI method to connect several MySQL database servers with my Pentaho PDI (CE 5.0.1) and working fine till now, excpet the one. One of the MySQL server went down, so I changed my JNDI connection (...\data-integration\simple-jndi\jdbc.properties) to connect to new server, but Kettle is not recogising this change and throwing the error as follows:
Error connecting to database [db-name] : org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
Invalid JNDI connection kidr_db_5 : Could not create connection to database server. Attempted reconnect 3 times. Giving up.
org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
Invalid JNDI connection kidr_db_5 : Could not create connection to database server. Attempted reconnect 3 times. Giving up.
I can connect to new server directly from Kettle through Native(JDBC) connection method, but not through JNDI only for this new server. Rest DB connection from JNDI working fine. Please guide me whats wrong here? Am missing something? or is it a bug?

I had resolved this issue, sorry in replying lately. The problem was, the password included few special characters including # symbol; but in Pentaho, # is a comment line, so part of password was appeared to be comment for Pentaho.
So the conclusion is, don't use # other than comments in either JNDI configuration or Kettle configuration files.

Quick info.
Not exactly it is a Kettle Pentaho bug. Bug(if it is not made intentionally) is in "simple-jndi" library. Library simple-jndi is used by Kettle, to provide jndi context. While oracle documentation of java.util.Properties class (http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html) states that, comment line must started by '#' symbol and it must be the first symbol in the line, library "simple-jndi" - use own loader, called org.osjava.sj.loader.util.CustomLoader. That is where bug resides
int idx = line.indexOf('#');
// remove comment
if(idx != -1) {
line = line.substring(0,idx);
}
So comment is everything after '#' symbol in the line if u use simple-jndi.

use .xml instead of .properties
<?xml version="1.0" encoding="UTF-8"?>
<something>
<connection-name>
<type>javax.sql.DataSource</type>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/database</url>
<user>user</user>
<password>#secret#</password>
</connection-name>
</something>
my files is called connections.xml
and then you can refer to connections/something/connection-name
in pdi for above example

Related

ActiveMQ integration with Oracle Service bus(OSB) 12c

we are trying to do the assessment around ActiveMQ to use in OSB 12c as JMS based integration. I did follow few blogs like https://bizzperform.com/blog/?p=686 but this is not helping and generating error like below.
did anyone came across this scenario and did implemented same .. kinldy advise.
<Failed to check whether connection factory LocalConnectionFactory supports XA. Will assume it does not: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.activemq.jndi.ActiveMQInitialContextFactory [Root exception is java.lang.ClassNotFoundException:
Active MQ client jar is missing from domain class path, you need to download it and add to PRE_CLASSPATH
Thanks, I finally got it working.
two quick changes and that worked
added the jar file in setDomainEnv.cmd like this
set PRE_CLASSPATH=%DOMAIN_HOME%\lib\activemq-all-5.16.3.jar;%PRE_CLASSPATH%
or you can put the complete URL of domain home.
while configuring the JMS on OSB, its always tricky to set the JNDI and I had to use both like below
jms://localhost:7001//
this helped and established a connection.

Not able to connect to DB if tried to load the connection string from secure vault

if I place the DB connection string in secure vault and deploy that on cloud hub , I am getting Error: "java.net.SocketTimeoutException: Receive timed out" ,exception and i am not able to connect to DB .
surprisingly , If i place the same property in plain properties file its working fine .
What is happening here ? pls advise me if anybody has encountered the same issue
Thanks
Naveen H
Most likely the property is not being set correctly. You didn't share any details on what secure method are you using and the exact configuration to be more precise. Try using the plain configuration in the DB config and print the secure one in a logger, to see if they match.

Apache Jmeter JDBC connection issue - JDBC driver class not found

I am trying to connect to PL/SQL 8.0.4.1514 through JMeter.
In JDBC connection configuration ,I have provided the database URL as "jdbc:oracle:thin:#//01HW552780:6129))/tnsfile" and JDBC driver class as "com.plsql.jdbc.Driver"
But getting error as "No suitable driver found for jdbc:oracle:thin:#//01HW552780:6129))/tnsfile"
Could someone rectify me here regarding driver class?
I believe that you need oracle.jdbc.OracleDriver class instead.
I believe that you need to remove // from your JDBC URL
I'm not too sure regarding tnsfile (unless it is you real oracle database name) as Oracle JDBC URL takes forms:
jdbc:oracle:thin:#host:port /databaseName
jdbc:oracle:thin:#host:port :serviceName
Relevant driver can be downloaded from Oracle website or alternatively (better) take it from $ORACLE_HOME/jdbc/ folder on the machine where Oracle lives
See The Real Secret to Building a Database Test Plan With JMeter guide for more configuration and usage details for the JDBC Sampler.
Faced the same problem.
I used oracle.jdbc.OracleDriver as Driver Class.
No need to remove //. It can be present.
In database URL, it should be jdbc:oracle:thin:#//MachineName:Port/Schema
Download or better copy JDBC Jars from your DB installation and paste it under Jmeter/lib path.
For example, I presume you DB as Oracle 12c, it required ojdbc6.jar and ojdbc7.jar copied and pasted under Jmeter/lib folder.
After this activity, the problem vanished away for me.

DataSource naming JBossEAP 6.2 vs Web Logic

I am porting a suite of related applications from WebLogic to JBoss EAP v6.2.
I have set up a data source connection using the JBoss command line interface and hooked it to an oracle database. This database has a name of "mydatasource" and a JNDI name of
"java:jboss/datasources/mydatasource" as per JBoss standards. I can test and validate this database connection.
However, when I try to port the code and run it, the connection doesn't work. The code that worked in WebLogic was simply:
InitialContext ic = new InitialContext() ;
DataSource ds = (DataSource)ic.lookup(dataSource) ;
with a value in dataSource of "mydatasource".
This worked in Web Logic but in JBoss it throws a NameNotFoundException
javax.naming.NameNotFoundException: mydatasource-- service jboss.naming.context.java.mydatasource
Clearly there is a difference in how the InitialContext is set up between the two servers.
But this port involves a large number of small applications, all of which connect to the datasource via code like that above. I don't want to rewrite all that code.
Is there a way through configuration (InitialContextFactory, maybe) to define the initial context such that code like that above will work without rewriting, or perhaps is there another way of naming the datasource that JBoss will accept that would allow code like that above to work without rewriting?
Or must we bite the bullet and accept that this code needs a rewrite?
Update: Yes, I know that simply passing "java:jboss/datasources/mydatasource" to the InitialContext lookup solves the problem, but I am looking for a solution via configuration, rather than via coding if there is such a solution.
The way to do this correctly through configuration is to use
java:comp/env/jdbc/myDataSource
then use resource-ref in web.xml to map it to the declare datasource and use weblogic.xml or jboss-web.xml to actually map it to the real one
in weblogic admin console, when you define datasource it can be jdbc/realDataSource
JNDI path Tomcat vs. Jboss
For weblogic http://docs.oracle.com/cd/E13222_01/wls/docs103/jdbc_admin/packagedjdbc.html

how to fix Javax. Naming.exception: nameNotFoundException <my_JNDI_name> not found

I got this exception while trying to deploy ejb-jar file on a glassfish 2.1 :
Javax. Naming.exception: nameNotFoundException not found.
This drive me to be crazy !!!
I don't know why i got this exception while when i launch the hole application (ear) using Netbeans 6.7.1 with integrated glassfish 2.1 it work like magic !
But when i try to deploy it manually under another glassfish in an other pc it does not work
And i am having this exception when i try to deploy it
So i think that the ejb module does not find out how to link to the database
So it must be something that the netbeans do and i am not, when deploying the ejb-jar
Any help ?
I realise this is a bit old, but having just worked through this, I thought I may as well document it here.
For me the issue was the database connection. In your project you should have a persistence.xml file (mine was in the EJB project), which details the database connection parameters. I was using a localhost URL, but when I ran the database project, I noticed in my Services tab under Glassfish that no database connection was being registered.
Here's what I did:
Create a new database connection (right click in Services, Java DB node)
In Services, right click Java DB connection, Properties, check that the pool it's registered to is in the Glassfish JDBC Connection Pools and is the correct one, if not, make sure your database connection is correct, update persistence.xml
Clean the project before running again
This worked for me, hope it's helpful for someone else.