ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: DDL support from Ibatis
Date Wed, 29 Oct 2008 16:44:38 GMT
DDL is not "officially" supported in iBATIS - for whatever that's
worth.  But many people run DDL statements successfully.

The problem seems obvious to me - Sybase does not allow DDL statements
in transactions (this is true of many other databases also).  So you
need to get rid of the startTransaction(), commitTransaction() calls.
Also, I would suggest executing the DDL with the queryForObject()
method so iBATIS won't wrap a transaction around the call.

Jeff Butler




On Tue, Oct 28, 2008 at 5:37 PM, Sekar, Sowmya <ssekar@ucsd.edu> wrote:
> Hi,
>
> I am trying to rename a table from ibatis.
>
>                 Try{
>
>             String resource = "sql-map-config.xml";
>
>             Reader reader = Resources.getResourceAsReader(resource);
>
>             sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>
>             reader.close();
>
>
>
>             sqlMap.update("table", null);
>
>             sqlMap.startTransaction();
>
> //code here
>
>             sqlMap.commitTransaction();
>
>       }
>
> Catch(Exception e)
>
> {
>
> }
>
> Finally{
>
>       sqlMap.endTransaction();
>
> }
>
>
>
> Sql-map-config.xml :
>
> EXEC sp_rename old_table, new_table
>
>
>
> When I Execute this piece, it throws an exception :
>
>
>
> --- Cause: com.sybase.jdbc2.jdbc.SybSQLException: Can't run sp_rename from
> within a transaction.
>
>
>
> What could be the problem?
>
> Is DDL supported by Ibatis or not?
>
> Sowmya Sekar
>
>

Mime
View raw message