cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Harner <bobhar...@gmail.com>
Subject Executing raw SQL
Date Tue, 04 Sep 2012 00:55:34 GMT
Hey everybody,

In a web app that uses Cayenne 3.0.1 with an embedded Derby database, I
need to perform a Derby-specific SQL query to do a database backup:

CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE('D:/dbbackups/');

How would I do that using Cayenne APIs? I looked at SQLTemplate (
http://cayenne.apache.org/doc/sqltemplate-basics.html), but it wants an
entity class to use as a root, which doesn't seem applicable here.

Alternatively, how can I get access to the database connection so I can run
straight JDBC?

private void backUpDatabase(Connection conn) throws SQLException
{
String sqlstmt = "CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE(?)";
CallableStatement cs = conn.prepareCall(sqlstmt);
cs.setString(1,"D:/dbbackups/");
cs.execute();
cs.close();
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message