Hi!

I can't get this code to work. Does anybody know why H2 doesn't accept
the second argument (the password string)?

String sql = "RUNSCRIPT FROM ? COMPRESSION DEFLATE CIPHER AES
PASSWORD ?";
PreparedStatement prepstat = conn.prepareStatement(sql);
prepstat.setString(1, backupFilename);
prepstat.setString(2, pwdStr);
prepstat.executeUpdate();

02-22 20:27:13 jdbc[2]: exception
org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "RUNSCRIPT
FROM ? COMPRESSION DEFLATE CIPHER AES PASSWORD ?"; expected "string";
SQL statement:
RUNSCRIPT FROM ? COMPRESSION DEFLATE CIPHER AES PASSWORD ? [42001-160]

I have also tried with PASSWORD '?', but:

02-22 20:31:29 jdbc[2]: exception
org.h2.jdbc.JdbcSQLException: Invalid value "2" for parameter
"parameterIndex" [90008-160]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:
329)
        at org.h2.message.DbException.get(DbException.java:169)
        at
org.h2.message.DbException.getInvalidValueException(DbException.java:
215)
        at
org.h2.jdbc.JdbcPreparedStatement.setParameter(JdbcPreparedStatement.java:
1270)
        at
org.h2.jdbc.JdbcPreparedStatement.setString(JdbcPreparedStatement.java:
327)

Best regards,
Johan

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to