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 HisashiTanaka <h-...@sknet.senko.co.jp> on 2007/11/20 09:15:00 UTC
Firebird with JNDI problem
Hello Everyone.
I'm a new to iBATIS.
Have any idea what I am going to do ??
I connected to Firebird2.0 by Tomcat5.5 JNDI,
When I try to insert a row, Errors occured as following.
May be Firebird's problem ??
May be iBATIS's problem ??
or May be Tomcat's wrong configuration ??
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in animalphoto/ibatis/SQLMapLog.xml.
--- The error occurred while applying a parameter map.
--- Check the insLog-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544361.
attempted update during read-only transaction
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:59)
I wrote MapConfig as following.
Using JNDI error occured.
<sqlMapConfig>
<transactionManager type="JDBC">
<dataSource type="JNDI">
<property name="DataSource" value="java:comp/env/jdbc/websch"/>
</dataSource>-->
</transactionManager>
<sqlMap resource="animalphoto/ibatis/SQLMapLog.xml"/>
</sqlMapConfig>
Using SIMPLE successfully executed.
<sqlMapConfig>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver"
value="org.firebirdsql.jdbc.FBDriver"/>
<property name="JDBC.ConnectionURL"
value="jdbc:firebirdsql:??.??.??.??/3050:websch?lc_ctype=SJIS_0208"/>
<property name="JDBC.Username" value="websch"/>
<property name="JDBC.Password" value="websch"/>
</dataSource>-->
</transactionManager>
<sqlMap resource="animalphoto/ibatis/SQLMapLog.xml"/>
</sqlMapConfig>
=== SQLMapLog.xml ===
<sqlMap>
<insert id="insLog" parameterClass="java.util.HashMap">
INSERT INTO LOG_PAGEFILTER(USERID, URI, SESSIONID, TM, RMTADDRESS,
TMDIF, MEMFREE)
VALUES (
#USERID#, #URI#, #SESSIONID#, #TM#, #RMTADDRESS#, #TMDIF#, #MEMFREE#
)
</insert>
</sqlMap>
=== My Java method ===
public boolean addAFilterLogByIBatis() throws SQLException {
SqlMapClient sqlMap = IBSQLConfig.getSqlMapInstance();
Map map = new HashMap();
map.put("USERID", this.userID);
map.put("URI", this.reqURI);
map.put("SESSIONID", this.sessionID);
map.put("TM", this.reqTM);
map.put("RMTADDRESS", this.rmtAddress);
map.put("TMDIF", new Integer(this.timeDif));
map.put("MEMFREE", new Integer(this.memFree));
//#USERID, #URI, #SESSIONID, #TM, #RMTADDRESS, #TMDIF, #MEMFREE
boolean res;
try {
sqlMap.startTransaction();
sqlMap.insert("insLog", map);
sqlMap.commitTransaction();
res = true;
}
catch (Exception e) {
e.printStackTrace();
res = false;
}
finally {
sqlMap.endTransaction();
}
return res;
}
--
View this message in context: http://www.nabble.com/Firebird-with-JNDI-problem-tf4841834.html#a13852539
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Firebird with JNDI problem
Posted by Larry Meadors <lm...@apache.org>.
OK, can you read data OK? I assume you can, but that might be a good
'sanity check' on the database connection.
The FB docs say that means "Attempted update during read-only
transaction". I'd try the same thing with straight JDBC and see if it
works.
Larry
On Nov 20, 2007 1:15 AM, HisashiTanaka <h-...@sknet.senko.co.jp> wrote:
>
> Hello Everyone.
>
> I'm a new to iBATIS.
> Have any idea what I am going to do ??
>
> I connected to Firebird2.0 by Tomcat5.5 JNDI,
> When I try to insert a row, Errors occured as following.
>
> May be Firebird's problem ??
> May be iBATIS's problem ??
> or May be Tomcat's wrong configuration ??
>
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in animalphoto/ibatis/SQLMapLog.xml.
> --- The error occurred while applying a parameter map.
> --- Check the insLog-InlineParameterMap.
> --- Check the statement (update failed).
> --- Cause: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544361.
> attempted update during read-only transaction
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:59)
>
>
>
> I wrote MapConfig as following.
>
> Using JNDI error occured.
>
> <sqlMapConfig>
> <transactionManager type="JDBC">
> <dataSource type="JNDI">
> <property name="DataSource" value="java:comp/env/jdbc/websch"/>
> </dataSource>-->
> </transactionManager>
> <sqlMap resource="animalphoto/ibatis/SQLMapLog.xml"/>
> </sqlMapConfig>
>
> Using SIMPLE successfully executed.
>
> <sqlMapConfig>
> <transactionManager type="JDBC">
> <dataSource type="SIMPLE">
> <property name="JDBC.Driver"
> value="org.firebirdsql.jdbc.FBDriver"/>
> <property name="JDBC.ConnectionURL"
>
> value="jdbc:firebirdsql:??.??.??.??/3050:websch?lc_ctype=SJIS_0208"/>
> <property name="JDBC.Username" value="websch"/>
> <property name="JDBC.Password" value="websch"/>
> </dataSource>-->
> </transactionManager>
> <sqlMap resource="animalphoto/ibatis/SQLMapLog.xml"/>
> </sqlMapConfig>
>
>
> === SQLMapLog.xml ===
>
> <sqlMap>
> <insert id="insLog" parameterClass="java.util.HashMap">
> INSERT INTO LOG_PAGEFILTER(USERID, URI, SESSIONID, TM, RMTADDRESS,
> TMDIF, MEMFREE)
> VALUES (
> #USERID#, #URI#, #SESSIONID#, #TM#, #RMTADDRESS#, #TMDIF#, #MEMFREE#
> )
> </insert>
> </sqlMap>
>
> === My Java method ===
>
> public boolean addAFilterLogByIBatis() throws SQLException {
>
> SqlMapClient sqlMap = IBSQLConfig.getSqlMapInstance();
>
> Map map = new HashMap();
> map.put("USERID", this.userID);
> map.put("URI", this.reqURI);
> map.put("SESSIONID", this.sessionID);
> map.put("TM", this.reqTM);
> map.put("RMTADDRESS", this.rmtAddress);
> map.put("TMDIF", new Integer(this.timeDif));
> map.put("MEMFREE", new Integer(this.memFree));
>
> //#USERID, #URI, #SESSIONID, #TM, #RMTADDRESS, #TMDIF, #MEMFREE
>
> boolean res;
> try {
> sqlMap.startTransaction();
> sqlMap.insert("insLog", map);
> sqlMap.commitTransaction();
> res = true;
> }
> catch (Exception e) {
> e.printStackTrace();
> res = false;
> }
> finally {
> sqlMap.endTransaction();
> }
> return res;
>
> }
>
> --
> View this message in context: http://www.nabble.com/Firebird-with-JNDI-problem-tf4841834.html#a13852539
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>