Search code examples
csvh2

Export data from H2 database into CSV


I have a stand alone H2 server up and running gathering data. For testing I want to get data out my server into a CSV file. Are there any tools for that?


Solution

  • Try CSVWRITE

    This is perhaps all that you need:

    call CSVWRITE ( 'C:/MyFolder/MyCSV.txt', 'SELECT * FROM MYTABLE' ) 
    

    You need to just run the call (mentioned above) in the browser based client of H2 that you are most likely using.

    Further reading: http://www.h2database.com/html/functions.html#csvwrite.