CSVREAD not requiring admin rights

43 views
Skip to first unread message

Chris Sunderland

unread,
Jan 3, 2017, 3:59:42 PM1/3/17
to H2 Database
It doesn't appear that CSVREAD is requiring admin rights per the documentation.  However CSVWRITE properly throws an error if I try to execute this as a standard user:

Exception in thread "main" org.h2.jdbc.JdbcSQLException: Admin rights are required for this operation; SQL statement:
CALL CSVWRITE('c:/temp/test.csv', 'SELECT * FROM TableA'); [90040-176]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
at org.h2.message.DbException.get(DbException.java:178)

I am using H2 version 1.3.176.


Christian MICHON

unread,
Jan 4, 2017, 3:08:57 AM1/4/17
to H2 Database
Who created the folder c:\temp ?

If it was not created by your standard user account, you may have no rights to write into it. Please check the r/w rights access to it, even a simple file copy into it will give you a clue.

For me this works as I created the folder c:\temp myself with a standard user account. I tried with version 1.3.176

Chris Sunderland

unread,
Jan 4, 2017, 6:27:34 AM1/4/17
to H2 Database
Actually the CSVWRITE is correct here since I'm trying to execute this function as a non-admin user.  The documentation says that this function as well as CSVREAD require admin capabilities to execute.

But when I try to execute CSVREAD as a non-admin H2 user, the function succeeds when per the documentation it should fail.

Noel Grandin

unread,
Jan 4, 2017, 8:17:30 AM1/4/17
to H2 Database
Yeah, that's sounds like a bug. Please log an issue for it ( bonus points for also submitting a fix) :)
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Christian MICHON

unread,
Jan 4, 2017, 8:54:58 AM1/4/17
to H2 Database
Argh I'm sorry: you meant the "sa" user for the database management system, not the "administrator" of the windows OS (what I understood).

But to my honest opinion, there are many use cases where this bug (csvread working without requiring to be "sa" dbms user) is actually a good thing/feature.

csvread could be for example used to grab external data and write into an existing table where you're granted insert access. I do not understand why this should be forbidden.

On csvwrite: if you are granted select access on a table, I do not see why we should forbid writing data out. Any ETL tool supporting H2 will output CSV OOTB. Why should we use an ETL for this instead of pure H2 console scripts?
Reply all
Reply to author
Forward
0 new messages