Holy moly that's a lot of error. I didn't read every line but I didn't see any explanation of a database / sql error. How about trying your SQL in a simple main() test? You may be able to get a better explanation of the problem (SQL error, wrong privileges error, etc). Or may be the error is not a SQL error at all.