<?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: How to use dynamic DB name with mysql in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353550#M119714</link>
    <description>You can overwrite it simply in any tJava components with this code:&lt;BR /&gt;context.database = "SFData_" + TalendDate.format("yyyy-MM-dd-HH-mm-ss", TalendDate.getCurrentDate());&lt;BR /&gt;Please take care you overwrite this before the subjob using this database started.</description>
    <pubDate>Mon, 05 Aug 2013 21:41:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-08-05T21:41:11Z</dc:date>
    <item>
      <title>How to use dynamic DB name with mysql</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353547#M119711</link>
      <description>I have a job that exports data from Salesforce. Getting the data is easy, saving to mysql is easy. The challenge: Each time the job runs, I want to use a dynamically generated database name in the mysql database. Something like SFData-yyyy-mm-dd. How can I, in Talend, at the time the job runs generate a database name, create the database, and use it so that the data export from Saleforce goes into this database? Each time the job runs I want it to create a new database and put the data there.</description>
      <pubDate>Sat, 16 Nov 2024 11:57:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353547#M119711</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T11:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use dynamic DB name with mysql</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353548#M119712</link>
      <description>This should be possible.&lt;BR /&gt;I would use tMysqlRow component to execute the create database command.&lt;BR /&gt;All database properties should be read from context variables.&lt;BR /&gt;After creating the database, overwrite the context.database variable with your new name.&lt;BR /&gt;After that you start your data fetching and saving in a separate sub job.&lt;BR /&gt;In your database output components you can use the table action "Create table if not exists".&lt;BR /&gt;BTW. Each time the job runs? I guess you should think about it, because you can probably run a job in one day twice (e.g. for testing purposes).</description>
      <pubDate>Sun, 04 Aug 2013 08:47:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353548#M119712</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-04T08:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use dynamic DB name with mysql</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353549#M119713</link>
      <description>Thank you - this is clear except how do you over write the context.database variable? I see where it holds the database name, but I'm not sure how I would over write it.&lt;BR /&gt;As for DB name, yyyy-mm-dd was just an example, I actually use yyy-mm-dd-hh-mm-ss for things like this</description>
      <pubDate>Sun, 04 Aug 2013 16:56:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353549#M119713</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-04T16:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use dynamic DB name with mysql</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353550#M119714</link>
      <description>You can overwrite it simply in any tJava components with this code:&lt;BR /&gt;context.database = "SFData_" + TalendDate.format("yyyy-MM-dd-HH-mm-ss", TalendDate.getCurrentDate());&lt;BR /&gt;Please take care you overwrite this before the subjob using this database started.</description>
      <pubDate>Mon, 05 Aug 2013 21:41:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353550#M119714</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-05T21:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use dynamic DB name with mysql</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353551#M119715</link>
      <description>I'm stumped with the tJava component. I read the documentation, and it tells me next to nothing.
&lt;BR /&gt;I have output from a tSystem component going into a tJava component, and I know this works because I run it through a tLogRow and I see the expected output (my DB name that I want to use). I want to capture this in the tJava component and use it to set the name of the database that the tMysqlRow component will use. I do this to see if I'm getting it:
&lt;BR /&gt;System.out.println("-&amp;gt;" + (String)globalMap.get("tSystem_1_OUTPUT"));
&lt;BR /&gt;And it gives me null. Am I missing some way to capture the output of the tSystem component, or is there something special I have to do to pass the output of the tSystem to the tJava?
&lt;BR /&gt;Secondly, if I just try this:
&lt;BR /&gt;context.database = "testDB";
&lt;BR /&gt;In the tJava, I get "database cannot be resolved or is not a field"
&lt;BR /&gt;I'm getting nowhere with the tJava component - are there any better docs that cover it in more detail, or some more extensive examples of how to use it?</description>
      <pubDate>Thu, 08 Aug 2013 04:06:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353551#M119715</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-08T04:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use dynamic DB name with mysql</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353552#M119716</link>
      <description>tJava is for pure Java - whatever you want.  But it's not for use in a flow as all code in it is executed before the flow starts.&lt;BR /&gt;If you want to capture a globalMap variable set by a component (e.g. tSystem_1_OUTPUT) then tJava should be joined with OnComponentOK from the component in question.&lt;BR /&gt;If you want to write Java to act on a flow, you should use tJavaRow instead of tJava.</description>
      <pubDate>Sat, 10 Aug 2013 13:41:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-dynamic-DB-name-with-mysql/m-p/2353552#M119716</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2013-08-10T13:41:32Z</dc:date>
    </item>
  </channel>
</rss>

