Add a new item in the DB Add links related to this item in a relational table in the DB
Then, I need the last insert ID. The two steps come from the same source of data. That means I have a tReplicate with two branches : first to insert the value, second to insert the links. For the second step, I use to put a tMySQLInput, select the content of the table (just ID and name) and match with the data I just inserted (basically, the name). Obviously, I committed the first action before doing the second one. But the SELECT doesn't give me the ID. Seems it doesn't get the up-to-date data of the DB. On another sub-part of the job, I get this ID (one iteration later) and, obviously, I checked that my value is well inserted. I tried to use the tMySQLLastInsertId component, but I still have the problem : for the same iteration, no value returned. I used the same MySQL connection, of course. Any idead will be appreciated ! Thank you !
Hi, Have you checked component t<DB>lastInserted which fetches the last inserted ID from a selected DB Connection? TalendHelpCenter:tMysqlLastInsertId? Could you please post your job design screenshots into forum? Best regards Sabrina
Hi,
Yes, I tried tMySQLLastInsertID.
Actually, I had the same problem with that component.
I solved my problem by putting this component (tMySQLLastInsertID) right after the tMySQLOutput, and then I have the last ID directly, and I don't have to wait for the next iteration.
Thank you for your answer !