Trouble using DB_OUTPUT_TABLE

Hi,

I am new to Clover, and I am just beginning experimenting…

I have two questions :

  1. If I want to copy from one db to another one, with exactly the same tables.

Can I simply create two nodes (DB_INPUT_TABLE and DB_OUTPUT_TABLE) and an Edge between them, or should I put a SimpleCopy component inbetween ?

  1. I have tried first solution (two nodes bound directly) and get this error :

INFO: [WatchDog] Sucessfully started all nodes in phase!
Exception in thread “OUTPUT” java.lang.NullPointerException
at org.jetel.database.SQLUtil.getFieldTypes(Unknown Source)
at org.jetel.component.DBOutputTable.run(Unknown Source)

My metadata is

and edge is :

Both tables share the same metadata (their are created with the same DDL in two databases on the same postgresql cluster).

What does this exception mean ?

Thanks in advance,
Franck

Yes, it just works fine for me (Postgresql 8.0.3 and jdbc driver postgresql-8.2dev-500.jdbc3)

Thanks a lot for your responsivness,

Franck

Thanks,

this works, although I get this message :

ATTENTION: No metadata obtained for table: “oeccp”, using workaround …

What does this mean ?

Hello Franck !

Overall, it should be possible to directly connect DBInputTable and DBOutputTable.

Said that, I am not sure, it looks like the metadata extracted by the “select *” query somehow does not match the target table.

Try two things:
a) in your SQL query, specify list of fields you are going to extract. Make sure they are in the same order as in the target database.

b) try to use org.jetel.database.AnalyzeDB utility (or CloverGUI) to extract clover style metadata and use them in this graph.

If time permits, I will try to investigate it a bit more.

David.

Hello Franck !

If you just use “dbTable” attribute/parameter of the DB_OUTPUT_TABLE and specify the name of your output table, Clover will try to assemble its own insert statement based on the input metadata.
(Leave out “dbFields” and “sqlQuery”)

The problem is that with some databases and JDBC drivers versions this approach might not work.

David.

Hello David,

and thanks for the quick reply !

I have done what you suggested :

- run AnalyseDB
- define metadata using the generated xml file
- try different select / insert combination

Result is that metadata with “select * from mytable” works, as well as with an xml file.
“Select * from mytable” in DB_INPUT_TABLE component is fine too.

The point is in DB_OUTPUT_TABLE : to make it work, I had to mention each field in dbFields and cloverFields attributes, and to put an SQLCode with as many ‘?’ placeholders. Ommiting dbFields or cloverFields fails.

Is this expected behaviour or is there is simpler way ? (I just want to duplicate a table, mentionning each field name twice (dbFields, cloverFields) and counting the number of matching ‘?’ is cumbersome…

Any thought ?

Franck

Hello !

It means that your JDBC driver can’t provide metadata for prepared statement - it does not implement this feature. Clover uses its own gues as what column names and types it should use when communicating with DB.

Most of the time, it should work just fine.

David.