Six Stars

Erreur tJDBCConnection : Instruction fermée: getMetaData

Hello,

 

I I encountered a problem with reading data from  hybris database.

 

In the start, the job execute the sql request without problem but after some time i get the error 

[FATAL]: tJDBCInput_21 java.sql.SQLException: Instruction fermée: getMetaData

 

I don't understand why i get the data in 5 or 6 minutes after that i get this error.

 

In fact, there is a migration of hybris from 5.7 to 6.5, for the old version i used connection http to hybris

and for the new version i use https but i get a error of certificat :

[ERROR]: java.sql.SQLException: java.security.cert.CertificateException: No subject alternative names present

tJDBCConnection_1 java.sql.SQLException: java.security.cert.CertificateException: No subject alternative names present

 

How i can add this certificate in Talend ??

Thanks

 

 

 

 

6 REPLIES
Moderator

Re: Erreur tJDBCConnection : Instruction fermée: getMetaData

Hello,

Are you trying to import certification with the tSetKeyStore component to see if it works?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Erreur tJDBCConnection : Instruction fermée: getMetaData

Thanks Sabrina.

I added the certification to JDK but the problem again exist Smiley Sad

Moderator

Re: Erreur tJDBCConnection : Instruction fermée: getMetaData

Hello,

How did you add certification to JDK?

Here is a related scenario about TalendHelpCenter:Extracting customer information from a private WSDL file

to see if you need keystore files in your work flow?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Erreur tJDBCConnection : Instruction fermée: getMetaData

I added it by using this commande :

cd %JAVA_HOME%
bin\keytool -J-Duser.language=en -keystore jre\lib\security\cacerts -import -alias CERT_RECETTE -ext san=ip:'@IP' -file d:/certif.crt

But this not the solution.

I found another solution is to create this calss Java in routines to trust the certification

 

package routines;

import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;


public class TrustCertficate implements X509TrustManager  {

   
	public java.security.cert.X509Certificate[] getAcceptedIssuers() {
		   return null;
		}
	public void checkClientTrusted1(X509Certificate[] certs, String authType) {
	}

	public void checkServerTrusted1(X509Certificate[] certs, String authType) {
	}

	@Override
	 public void checkClientTrusted(java.security.cert.X509Certificate[]      paramArrayOfX509Certificate, String paramString)
	    throws CertificateException {
	  // TODO Auto-generated method stub

	}

	@Override
	public void checkServerTrusted(java.security.cert.X509Certificate[] paramArrayOfX509Certificate, String paramString)
	        throws CertificateException {
	    // TODO Auto-generated method stub
}
	
	public static void disableSSL() {
	      try {
	         TrustManager[] trustAllCerts = new TrustManager[] { new   TrustCertficate() };

	    // Install the all-trusting trust manager
	    SSLContext sc = SSLContext.getInstance("SSL");
	    sc.init(null, trustAllCerts, new java.security.SecureRandom());
	    HostnameVerifier allHostsValid = new HostnameVerifier() {
	        public boolean verify(String hostname, SSLSession session) {
	            return true;
	        }
	    };
	    HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
	    HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
	} catch (Exception e) {
	    e.printStackTrace();
	}}
	
}


just you need to call disableSSL in tjava component :

routines.TrustCertficate.disableSSL(); 

 

Six Stars

Re: Erreur tJDBCConnection : Instruction fermée: getMetaData

Now, after solution of certification, i had the first problem :

tJDBCInput_21 java.sql.SQLException: Instruction fermée: getMetaData

so the problem is not in the certification, i can use the old method with http not https.

The problem is the connection closure after 5 or 6 minutes after execution.

I think it's a problem in hybris

 

Moderator

Re: Erreur tJDBCConnection : Instruction fermée: getMetaData

Hi,

So far, we have no clue about your issue. Feel free to let us know if there is any further help we can give.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.