# Executing ETL graphs parallely from java

**URL:** <https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286>\
**Category:** CloverDX Platform\
**Created:** [February 14, 2008, 12:00am UTC](https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286 "2008-02-14T00:00:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![crfpkr](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@crfpkr](https://forum.cloverdx.com/u/crfpkr)\
**Post date:** [February 14, 2008, 12:00am UTC](https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286/1 "2008-02-14T00:00:00Z")

</div>

Hi \*

I am having a problem running the same graph from java code parallely. Is it a known behaviour of ETL or i must take care of few things before i run the graphs at the same time.

Another question in this regard would be , how the graph runs are handeld from java, i mean is

graphReader.read(new FileInputStream(graphFile));

is a singelton implementation or a new instance is made everytime this method is called.

Attached is the exception that i am getting … Actually i am reading an XML file and after transforming the data i write it to either database or to a file. for that i am using partition component.

Any help / advice will be appreciated…

```auto

14 Feb 2008 16:22:39,766 - ERROR [WatchDog] org.jetel.graph.Phase DB_OUTPUT_TABLE0 ...FAILED !
Connection with ID: Connection0 isn't instance of the DBConnection class.
        at org.jetel.component.DBOutputTable.init(DBOutputTable.java:321)
        at org.jetel.graph.Phase.init(Phase.java:161)
        at org.jetel.graph.runtime.WatchDog.executePhase(WatchDog.java:562)
        at org.jetel.graph.runtime.WatchDog.run(WatchDog.java:164)
14 Feb 2008 16:22:39,767 - ERROR [WatchDog] org.jetel.graph.runtime.WatchDog !!! Phase finished with error - stopping graph run !!!

```

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [February 15, 2008, 7:52am UTC](https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286/2 "2008-02-15T07:52:53Z")

</div>

Hi, could you clear up your problem? I’ve understand that when you run graph it works properly, but if you run 2 graphs at once you get the error. Is that right? Or you get error always?

---

<div class="post-metadata">

**Author:** ![crfpkr](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@crfpkr](https://forum.cloverdx.com/u/crfpkr)\
**Post date:** [February 15, 2008, 9:56am UTC](https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286/3 "2008-02-15T09:56:44Z")

</div>

Hi

Let me rephrase the problem that i am having.

I have an ETL graph to import an XML file in the database. I run this graph through a java class, which i have taken from the example code of ETL library and have changed according to my need. All works fine as far as i execute it for one file at a time. The problem comes when my application finds two or more files in a folder and try to execute both of them at the same time. That means, two instances of the java class through which i execute the graph file, try to import two files at the same time.

I hope this time i have explained the problem more precisely. If it is still not clear, plz let me know and i will try to explain it again…

thanx and regards

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [February 15, 2008, 10:12am UTC](https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286/4 "2008-02-15T10:12:13Z")

</div>

Could you show your java code?

---

<div class="post-metadata">

**Author:** ![crfpkr](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@crfpkr](https://forum.cloverdx.com/u/crfpkr)\
**Post date:** [February 15, 2008, 2:30pm UTC](https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286/5 "2008-02-15T14:30:11Z")

</div>

here is my code through which i execute the ETL graph.

```auto

private boolean execute(String dataFile, String metaData, String graphFile) {
		boolean flag = true;
		Defaults.init();
		Plugins.init("c:/plugins");

		DataRecordMetadata metadataIn = null;
		DataRecordMetadataXMLReaderWriter reader = new DataRecordMetadataXMLReaderWriter();

		try{
			metadataIn = reader.read(new FileInputStream(metaData));
		}catch(IOException ex){
			flag = false;
			throw new RuntimeException(ex);
		}

		if (metadataIn==null){
			flag = false;
			try {
				throw new RuntimeException("No INPUT metadata");
			} catch (Exception e) {
				
			}
		}

		TransformationGraph graph = new TransformationGraph();
		TransformationGraphXMLReaderWriter graphReader = new TransformationGraphXMLReaderWriter(graph);

		try {
			// set few properties in graph ...

			graphReader.read(new FileInputStream(graphFile));
		} catch (FileNotFoundException e) {
			flag = false;
			throw new RuntimeException(e);
		} catch (XMLConfigurationException e) {
			flag = false;
			throw new RuntimeException(e);
		} catch (GraphConfigurationException e) {
			flag = false;
			throw new RuntimeException(e);
		}

		if(!graph.init()){
			flag = false;
			logger.error("Graph initialization failed !");
		}

		if (!graph.run().equals(Result.FINISHED_OK)){
			flag = false; 
			logger.error("Failed starting all nodes!");
		}
	

	return flag;
}

```

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [February 18, 2008, 8:39am UTC](https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286/6 "2008-02-18T08:39:50Z")

</div>

I don’t see problem in your code (the more you don’t use dataFile in the body of the method), but if you want run graph for different input files it would be better to do graph as global variable or set fileURL attribute as “multi file” ([http://wiki.clovergui.net/doku.php?id=components:readers#readersfileurl](http://wiki.clovergui.net/doku.php?id=components:readers#readersfileurl))

---

<div class="post-metadata">

**Author:** ![mishrahanuyahoocoin](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@mishrahanuyahoocoin](https://forum.cloverdx.com/u/mishrahanuyahoocoin)\
**Post date:** [July 7, 2008, 1:14pm UTC](https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286/7 "2008-07-07T13:14:04Z")

</div>

Hi,  
Please help me that whether this graph file name is the .grf file or the xml of the graph…i am getting error while runing graph from java

---

<div class="post-metadata">

**Author:** ![jurban](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jurban](https://forum.cloverdx.com/u/jurban)\
**Post date:** [July 14, 2008, 1:48pm UTC](https://forum.cloverdx.com/t/executing-etl-graphs-parallely-from-java/286/8 "2008-07-14T13:48:36Z")

</div>

> Hi,  
> Please help me that whether this graph file name is the .grf file or the xml of the graph…i am getting error while runing graph from java
> 
> “[mishra.hanu@yahoo.co.in](mailto:mishra.hanu@yahoo.co.in)”

Hi,  
I’m not sure if I understand your question. A Clover graph is stored in a .grf file, which contains an XML of the graph.

Jaro
