Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to insert a new row in DB using tRESTrequest (POST) and tDBoutput

Hi,

I am currently discovering Talend and I am trying to insert a new row in my DB using a post request (tRESTRequest) and a TDBoutput.
I am already able to GET the data of this table with a GET request

0683p000009M4CE.png.
See the following picture for the components of my tRESTrequest.

0683p000009M3eI.png
Picture 3 is for the parameters of my POST request (the famous [...]😞

0683p000009M4CJ.png

 

 

So when i try to use this service with the URL  "http://localhost:8088/userstalend/post/4/exname/exlastname" it shows me this error log: 

[WARN ]: org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper - javax.ws.rs.ClientErrorException: HTTP 405 Method Not Allowed
	at org.apache.cxf.jaxrs.utils.SpecExceptions.toHttpException(SpecExceptions.java:117)
	at org.apache.cxf.jaxrs.utils.ExceptionUtils.toHttpException(ExceptionUtils.java:167)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod(JAXRSUtils.java:513)
	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:181)
	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:78)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
	at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:247)
	at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:79)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1182)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1116)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:534)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
	at java.lang.Thread.run(Unknown Source)

Thu May 16 16:50:09 CEST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Thu May 16 16:50:09 CEST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
.--+---------+--------.
|      tLogRow_2      |
|=-+---------+-------=|
|id|firstname|lastname|
|=-+---------+-------=|
|1 |Gang     |Oui     |
|2 |HaveToBe |AlphaMan|
|3 |PlusTrop |Didees  |
'--+---------+--------'

So it does not have inserted the new row in my CB and my Job is paused like that (only the interresting part: the POST part) without any new row for the output: 

0683p000009M4Ai.png

Am I missing something? 

Thanks in advance.

EDIT: I hope that I am asking this in the good section..

 

Labels (2)
1 Reply
Anonymous
Not applicable
Author

Hello

Sorry, you question is not clear

From my understanding :
1- use REST request to get the data : This step is ok
2- Insert the data in the database : not working

If you have access to the database, why not connect directement to the database and insert the data?

In the case you can only insert in the database using an API, have you tested the API with the data you have been able to extract using talend?