You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by sl...@gmx.de on 2009/04/08 13:04:08 UTC

Transfer sql scripts to database with iBatis

Hello!

I'd like to setup my database before accessing it with iBatis. Therefore I'd like to execute a SQL script (triggers, stored procs, functions, table creation)
on my database, which will be sent using iBatis.

Is there a way to directly send and execute this data?
Or do I have to use JDBC?
Is there a underlying access point under the SQLMapperClient?

Thank you for your time!

Paule



Re: Transfer sql scripts to database with iBatis

Posted by "qujinlong.feed" <qu...@gmail.com>.
Connection conn = sqlMapClient.getDataSource().getConnection();

ScriptRunner runner = new ScriptRunner(conn, false, false);

for (String script : scripts)
{
  runner.runScript(Resources.getResourceAsReader(script));
}




qujinlong.feed
2009-04-09



发件人: slayer81
发送时间: 2009-04-08 19:05:05
收件人: user-java
抄送: 
主题: Transfer sql scripts to database with iBatis

Hello!
I'd like to setup my database before accessing it with iBatis. Therefore I'd like to execute a SQL script (triggers, stored procs, functions, table creation)
on my database, which will be sent using iBatis.
Is there a way to directly send and execute this data?
Or do I have to use JDBC?
Is there a underlying access point under the SQLMapperClient?
Thank you for your time!
Paule