Suppose you want to export a MySQL database table to a CSV file.
Your table is called PRODUCTS and you are interested in the "id","description" and "long_descr" columns. The "id" column is numeric.
You can use the following script
# FROM DATABASE driver: com.mysql.jdbc.Driver url: jdbc:mysql://localhost/test;user=myuser;password=mypassword table: PRODUCTS # TO CSV fileName: prods.csv headers: true delimiter: , # COLUMN id => (0) name:id type:Number format:##### COLUMN description => (1) name:descr COLUMN long_descr => (2) name:longdescr
Look at the first section. Here you are saying that you want to read from a database indicating the JDBC driver name, the JDBC database URL and the name of the table you are reading from.
Refer to your RDBMS documentation for correct driver name and URL.
If you read [Your First DataFlush Script] you should already be familiar with the second section.
In the column section you can find only one thing new in the first line.
The "id" column is numeric but a CSV file is a text file so you need to say how to convert the number in a string.
The format string syntax is derived from teh DecimalFormat Java class. You can find documentation here
Before trying your script don't forget to put your JDBC driver in the DataFlush lib directory as described in the [Install DataFlush] page.
Now you should be able to guess how to write on a database. Otherwise read [Writing to a database]
Home: Home
Home: Install DataFlush
Home: Writing to a database
Home: Your First DataFlush Script