Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export data from H2 database into CSV

Tags:

csv

h2

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?

like image 425
user1633277 Avatar asked Jun 20 '13 16:06

user1633277


People also ask

How do I export data from H2 database?

Try CSVWRITE 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. Show activity on this post. Show activity on this post.

How can I recover data from H2 database?

H2 Console By default, the console view of the H2 database is disabled. Before accessing the H2 database, we must enable it by using the following property. Once we have enabled the H2 console, now we can access the H2 console in the browser by invoking the URL http://localhost:8080/h2-console.

How do I open a H2 db file?

Alternatively you can connect using the browser based H2 console. The easiest way to access the console is to double click the H2 database jar file at <installation-directory>\confluence\WEB-INF\lib\h2-x.x.x.jar .


1 Answers

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.

like image 95
partha Avatar answered Sep 29 '22 21:09

partha