<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DB2 Sequences in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286382#M60004</link>
    <description>I think your flow will end up something like this: 
&lt;BR /&gt;tDB2Connection 
&lt;BR /&gt; -- On Subjob OK 
&lt;BR /&gt;tDB2Input --&amp;gt; tMap --&amp;gt; tDB2Row --&amp;gt; Output 
&lt;BR /&gt;On the tDB2Row, you can keep your select as it is. 
&lt;BR /&gt;There is an option, on the Advanced settings tab of the tDB2Row to allow you to put the result of the query into a column. 
&lt;BR /&gt;Once you check "Propagate QUERY's recordset" a drop down box saying "use column" will appear and you choose what column you want to put the result in. 
&lt;BR /&gt;Of course, this means that you need to have a "blank" column to put the answer in. That will be the purpose of your tMap. Just add an extra column to hold your sequence number on the outgoing flow. 
&lt;BR /&gt;I created a real simple example with just one incoming column - see the attached pictures. 
&lt;BR /&gt;P.S. -&amp;gt; I wish my German were as good as your English. It's been many, many years since I had a chance to use it. Seeing your dialog box brought back some fond memories. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCnB.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/140182i1F7F0B7E17636B5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCnB.jpg" alt="0683p000009MCnB.jpg" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCPP.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/143070iF9DBC6DC9D50D070/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCPP.jpg" alt="0683p000009MCPP.jpg" /&gt;&lt;/span&gt;</description>
    <pubDate>Tue, 05 Aug 2008 22:21:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-08-05T22:21:47Z</dc:date>
    <item>
      <title>DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286377#M59999</link>
      <description>Hallo, 
&lt;BR /&gt;a question from a newbie to talend. 
&lt;BR /&gt;I have to use DB2 sequences in the following way: 
&lt;BR /&gt;1.: selecting data from a table (from one schema) 
&lt;BR /&gt;2.: inserting the data into another table (another schema), adding a sequence key to each row (the sequence object of the target table is defined; via command line I can insert the data) 
&lt;BR /&gt;(for testing, i changed this step to: output to a file, but using the sequence object in the database) 
&lt;BR /&gt; 
&lt;BR /&gt;I've tried it in the following way: 
&lt;BR /&gt;connecting to the Database (done it in other examples, it is okay; DB2: Client 8.1; Server: v9.1) 
&lt;BR /&gt;- selecting the sequence object 
&lt;BR /&gt;- selecting the data 
&lt;BR /&gt;'join' them and output them to a file (for testing) 
&lt;BR /&gt;But this seems to be wrong: 
&lt;BR /&gt;Starte Job test_kk am 15:04 01/08/2008. 
&lt;BR /&gt;java.lang.NoClassDefFoundError: test/test_kk_0_1/test_kk 
&lt;BR /&gt;Caused by: java.lang.ClassNotFoundException: test.test_kk_0_1.test_kk 
&lt;BR /&gt; at java.net.URLClassLoader$1.run(Unknown Source) 
&lt;BR /&gt; at java.security.AccessController.doPrivileged(Native Method) 
&lt;BR /&gt; at java.net.URLClassLoader.findClass(Unknown Source) 
&lt;BR /&gt; at java.lang.ClassLoader.loadClass(Unknown Source) 
&lt;BR /&gt; at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
&lt;BR /&gt; at java.lang.ClassLoader.loadClass(Unknown Source) 
&lt;BR /&gt; at java.lang.ClassLoader.loadClassInternal(Unknown Source) 
&lt;BR /&gt;Exception in thread "main" 
&lt;BR /&gt;Job test_kk endet am 15:04 01/08/2008. 
&lt;BR /&gt;The problem seems to be the selection of the sequence. 
&lt;BR /&gt;Any Idea? 
&lt;BR /&gt;Thanks 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCn6.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/136999i3E2D49EF10F42F90/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCn6.jpg" alt="0683p000009MCn6.jpg" /&gt;&lt;/span&gt;</description>
      <pubDate>Sat, 16 Nov 2024 14:16:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286377#M59999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T14:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286378#M60000</link>
      <description>Why not just define a column in the DB2 table where you are going to insert the data into to be a sequence number column and let DB2 handle it for you? 
&lt;BR /&gt;Here's sample DDL... 
&lt;BR /&gt;CREATE TABLE MYTABLE1 ( 
&lt;BR /&gt; MY_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY ( 
&lt;BR /&gt; START WITH +1 
&lt;BR /&gt; INCREMENT BY +1 
&lt;BR /&gt; MINVALUE +1 
&lt;BR /&gt; MAXVALUE +9000000 
&lt;BR /&gt; NO CYCLE 
&lt;BR /&gt; CACHE 20 
&lt;BR /&gt; NO ORDER ) , 
&lt;BR /&gt; BATCH_ID SMALLINT NOT NULL , 
&lt;BR /&gt; TABLE_ID SMALLINT NOT NULL , 
&lt;BR /&gt; SEQ SMALLINT NOT NULL , 
&lt;BR /&gt; PROC_KEY CHAR(5) 
&lt;BR /&gt; );</description>
      <pubDate>Fri, 01 Aug 2008 19:56:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286378#M60000</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-01T19:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286379#M60001</link>
      <description>Sorry, unfortunately we can't change the DB2 in that way, it has "historical reasons".&lt;BR /&gt;Any other ideas?&lt;BR /&gt;Thanks a lot.</description>
      <pubDate>Mon, 04 Aug 2008 07:18:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286379#M60001</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-04T07:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286380#M60002</link>
      <description>You can use the numeric.sequence function in your tMap. Var Expression: Numeric.sequence("seqnum",1,1) 
&lt;BR /&gt;Then you'll just need to initialize that variable by doing a SQL select max(IDColumn) on your table.</description>
      <pubDate>Mon, 04 Aug 2008 17:48:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286380#M60002</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-04T17:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286381#M60003</link>
      <description>Dear SMaz, 
&lt;BR /&gt;I've tried this, but then Talend is't able to generate code (see messagebox below). The appropriate error message is: 
&lt;BR /&gt;Starte Job test_kk am 08:24 05/08/2008. 
&lt;BR /&gt;java.lang.NoClassDefFoundError: test/test_kk_0_1/test_kk 
&lt;BR /&gt;Caused by: java.lang.ClassNotFoundException: test.test_kk_0_1.test_kk 
&lt;BR /&gt; at java.net.URLClassLoader$1.run(Unknown Source) 
&lt;BR /&gt; at java.security.AccessController.doPrivileged(Native Method) 
&lt;BR /&gt; at java.net.URLClassLoader.findClass(Unknown Source) 
&lt;BR /&gt; at java.lang.ClassLoader.loadClass(Unknown Source) 
&lt;BR /&gt; at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
&lt;BR /&gt; at java.lang.ClassLoader.loadClass(Unknown Source) 
&lt;BR /&gt; at java.lang.ClassLoader.loadClassInternal(Unknown Source) 
&lt;BR /&gt;Exception in thread "main" 
&lt;BR /&gt;Job test_kk endet am 08:24 05/08/2008. 
&lt;BR /&gt; 
&lt;BR /&gt;Perhaps it is the best to describe the situation (what I want to do) a little more detailed. 
&lt;BR /&gt;We have an existing DB2 database (v8 / v9) where sequence objects are created like 
&lt;BR /&gt;create sequence SCHEMANAME.SEQ_&amp;lt;REFERENCED_TABLENAME&amp;gt; as INTEGER 
&lt;BR /&gt;start with 1 
&lt;BR /&gt;increment by 1 
&lt;BR /&gt;minvalue 1 
&lt;BR /&gt;maxvalue 2147483647 
&lt;BR /&gt;cache 20 
&lt;BR /&gt;order; 
&lt;BR /&gt;The sequence has, except of the 'seq'-prefix, the same name as the table where it is 'used' (in the table exists a corresponding integer-key-column). 
&lt;BR /&gt;To fill the table with a new row, a select of the next value from the sequence object has to be made and the result is then the new value of the new row (sorry, we can't change this behavior). 
&lt;BR /&gt;So, what do I have to do to insert new data with talend? 
&lt;BR /&gt;I tried out the following to test it (I don't need to use the Number.sequence in this way): selecting the sequence and writing it into a file, joined with the inserted data: 
&lt;BR /&gt;- connect to the db (tDB2Connection) 
&lt;BR /&gt;- - onSubjobOk: select the next number from the sequence (tDB2Row: SELECT (nextval for schemaname.SEQ_AKT_AKTIVITAET) as seq from sysibm.sysdummy1)) 
&lt;BR /&gt;- - onSubjobOk: using a tDB2Input to collect the other data 
&lt;BR /&gt;- - - join the two '- -' actions (the sequence as a 'Lookup', the other as 'Main') via the tMap (joining the outputs) and output them to a tFileOutputDelimited object 
&lt;BR /&gt;When doing it in this way, a similar error as the above one pops up: 
&lt;BR /&gt;Starte Job test_kk am 09:15 05/08/2008. 
&lt;BR /&gt;java.lang.NoClassDefFoundError: test/test_kk_0_1/test_kk 
&lt;BR /&gt;Caused by: java.lang.ClassNotFoundException: test.test_kk_0_1.test_kk 
&lt;BR /&gt; at java.net.URLClassLoader$1.run(Unknown Source) 
&lt;BR /&gt; at java.security.AccessController.doPrivileged(Native Method) 
&lt;BR /&gt; at java.net.URLClassLoader.findClass(Unknown Source) 
&lt;BR /&gt; at java.lang.ClassLoader.loadClass(Unknown Source) 
&lt;BR /&gt; at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
&lt;BR /&gt; at java.lang.ClassLoader.loadClass(Unknown Source) 
&lt;BR /&gt; at java.lang.ClassLoader.loadClassInternal(Unknown Source) 
&lt;BR /&gt;Exception in thread "main" 
&lt;BR /&gt;Job test_kk endet am 09:15 05/08/2008. 
&lt;BR /&gt; 
&lt;BR /&gt;Not very complicated things (but somehow wrong?)... 
&lt;BR /&gt;I think, this should be solveable in Talend. 
&lt;BR /&gt;Thanks for an answer 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MClQ.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155375iDED73A0C19CC6AC0/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MClQ.jpg" alt="0683p000009MClQ.jpg" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 05 Aug 2008 08:16:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286381#M60003</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-05T08:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286382#M60004</link>
      <description>I think your flow will end up something like this: 
&lt;BR /&gt;tDB2Connection 
&lt;BR /&gt; -- On Subjob OK 
&lt;BR /&gt;tDB2Input --&amp;gt; tMap --&amp;gt; tDB2Row --&amp;gt; Output 
&lt;BR /&gt;On the tDB2Row, you can keep your select as it is. 
&lt;BR /&gt;There is an option, on the Advanced settings tab of the tDB2Row to allow you to put the result of the query into a column. 
&lt;BR /&gt;Once you check "Propagate QUERY's recordset" a drop down box saying "use column" will appear and you choose what column you want to put the result in. 
&lt;BR /&gt;Of course, this means that you need to have a "blank" column to put the answer in. That will be the purpose of your tMap. Just add an extra column to hold your sequence number on the outgoing flow. 
&lt;BR /&gt;I created a real simple example with just one incoming column - see the attached pictures. 
&lt;BR /&gt;P.S. -&amp;gt; I wish my German were as good as your English. It's been many, many years since I had a chance to use it. Seeing your dialog box brought back some fond memories. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCnB.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/140182i1F7F0B7E17636B5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCnB.jpg" alt="0683p000009MCnB.jpg" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCPP.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/143070iF9DBC6DC9D50D070/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCPP.jpg" alt="0683p000009MCPP.jpg" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 05 Aug 2008 22:21:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286382#M60004</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-05T22:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286383#M60005</link>
      <description>Thank's for Your endeavors to assist, but this answer leads to another problem: 
&lt;BR /&gt;it seems that Talend "don't know", that the result of the sequence query ist only one integer and not a complete resultset. 
&lt;BR /&gt;As a result, another error message was generated: 
&lt;BR /&gt;Starte Job test_xxx am 15:00 06/08/2008. 
&lt;BR /&gt;Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
&lt;BR /&gt; Type mismatch: cannot convert from ResultSet to Integer 
&lt;BR /&gt; at test.test_xxx_0_1.test_xxx.tDB2Input_1Process(test_xxx.java:1124) 
&lt;BR /&gt; at test.test_xxx_0_1.test_xxx.tDB2Connection_1Process(test_xxx.java:216) 
&lt;BR /&gt; at test.test_xxx_0_1.test_xxx.runJobInTOS(test_xxx.java:1371) 
&lt;BR /&gt; at test.test_xxx_0_1.test_xxx.main(test_xxx.java:1286) 
&lt;BR /&gt;Job test_xxx endet am 15:00 06/08/2008. 
&lt;BR /&gt;Or had I done something wrong once again? 
&lt;BR /&gt;Thanks for Your patience! 
&lt;BR /&gt;PS: Thank You for jour praise of my english, but I think it isn't really so good (the dictionary is my best friend)! 
&lt;BR /&gt;Where did You learned the german language? Or are You from germany? 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCnG.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154280i508CCD7620B1280F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCnG.jpg" alt="0683p000009MCnG.jpg" /&gt;&lt;/span&gt;</description>
      <pubDate>Wed, 06 Aug 2008 14:23:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286383#M60005</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-06T14:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286384#M60006</link>
      <description>DB2 sequences seems to be some kind of "unsopported" by talend, am I right?&lt;BR /&gt;I reduced the components to three actions:&lt;BR /&gt;1.: connecting&lt;BR /&gt;2.: selecting via tDB2Row and the SQL statement "SELECT (nextval for KBP.SEQ_AKT_AKTIVITAET) as seq from sysibm.sysdummy1)" (perhaps another component should be used?)&lt;BR /&gt;3.: directing the poutput to a csv file&lt;BR /&gt;The second step comes up with a compilation error:&lt;BR /&gt;Starte Job seq_test am 16:04 08/08/2008.&lt;BR /&gt;Exception in thread "main" java.lang.Error: Unresolved compilation problem: &lt;BR /&gt;	OnSubjobOk cannot be resolved&lt;BR /&gt;	at tests.seq_test_0_1.seq_test.tDB2Row_1Process(seq_test.java:494)&lt;BR /&gt;	at tests.seq_test_0_1.seq_test.tDB2Connection_1Process(seq_test.java:206)&lt;BR /&gt;	at tests.seq_test_0_1.seq_test.runJobInTOS(seq_test.java:673)&lt;BR /&gt;	at tests.seq_test_0_1.seq_test.main(seq_test.java:588)&lt;BR /&gt;Job seq_test endet am 16:04 08/08/2008. &lt;BR /&gt;What is wrong with it?&lt;BR /&gt;The code ist very straightforward and, when even this easy thing goes wrong, what ist with the "real life problems"?&lt;BR /&gt;Does someone have an idea (a tested solution: selecting a sequence and writing it to a file (the output should be one line))?</description>
      <pubDate>Fri, 08 Aug 2008 15:19:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286384#M60006</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-08T15:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286385#M60007</link>
      <description>Has anyone sole the DB2 sequence problem? We use them all the time with Informatica.</description>
      <pubDate>Fri, 27 Mar 2009 18:47:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286385#M60007</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2009-03-27T18:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Sequences</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286386#M60008</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Has anyone sole the DB2 sequence problem? We use them all the time with Informatica.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Well, here is what I did.&lt;BR /&gt;1) A query in DB2 as a lookup in tMap just before the Load, with the query "SELECT 1&amp;nbsp;AS COD, (NEXTVAL FOR &amp;lt;SEQUENCE&amp;gt;) AS SEQ FROM SYSIBM.SYSDUMMY1."&lt;BR /&gt;2) A join with this loopkup, passing "1" fixed as Key. This will return the same latest value from sequence from all records.&lt;BR /&gt;3) 2 Variables in the tMap, one to receive the lookup value, and other to increase + 1. This will increment the latest value from sequence in the tMap.&lt;BR /&gt;4) Map the calculated variable to the sequence field in the target, and load the data.&lt;BR /&gt;5) After the loading (I did in a Postjob), a DB2 SP procedure running "ALTER SEQUENCE &amp;lt;SEQUENCE&amp;gt; RESTART WITH &amp;lt;LAST VALUE FROM TMAP&amp;gt;"&lt;BR /&gt;To catch the latest value calculated inside a tMap, i did a little trick in 3 parts. 1) A new output to a tAggregateRow with only the sequence variable with a MAX, 2) a new context variable in the Job called MaxId, 3) a tJavaRow to assign the Max value from the tAggregate to the context variable.&lt;BR /&gt;This worked fine for me...&lt;BR /&gt;Regards</description>
      <pubDate>Mon, 05 Oct 2015 19:04:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DB2-Sequences/m-p/2286386#M60008</guid>
      <dc:creator>Luiz_Filipe</dc:creator>
      <dc:date>2015-10-05T19:04:50Z</dc:date>
    </item>
  </channel>
</rss>

