MyBatis ORA-01745: invalid host/bind variable name

只愿长相守 提交于 2019-12-25 06:59:45

问题


I have an insert statement in MyBatis using Oracle 11g R2 on the backend with the Oracle ojdbc6 driver.

I am repeatedly getting

java.sql.SQLSyntaxErrorException: ORA-01745: invalid host/bind variable name

However I don't see what is causing the issue, I'm not using any Oracle reserved Keywords.

<insert id="createRecord" parameterType="org.appliication.core.domain.TRRecord"
            statementType="PREPARED" useGeneratedKeys="true" keyColumn="ID" keyProperty="id">

        INSERT INTO T_TR_PUBLICATION p (
          p.TR_UID,
          p.TITLE,
          p.ITEM_TITLE,
          p.COVER_DATE,
          p.HAS_ABSTRACT,
          p.ISSUE,
          p.SORT_DATE,
          p.VOLUME,
          p.BEGIN_PAGE,
          p.END_PAGE,
          p.ACCESSION_NO,
          p.ISSN,
          p.DOI,
          p.FUNDING_TEXT
        )
        VALUES (
          #{trUid, jdbcType=NULL},
          #{title, jdbcType=NULL},
          #{titleItem, jdbcType=NULL},
          #{coverDate, jdbcType=NULL},
          #{hasAbstract, jdbcType=NULL},
          #{issue, jdbcType=NULL},
          #{sortDate, jdbcType=NULL}
          #{journalVolume, jdbcType=NULL},
          #{pageBegin, jdbcType=NULL},
          #{pageEnd, jdbcType=NULL},
          #{accessionNo, jdbcType=NULL},
          #{issn, jdbcType=NULL},
          #{doi, jdbcType=NULL},
          #{fundingText, jdbcType=NULL}
        )

    </insert>

回答1:


Specify the actual type you want, e.g. VARCHAR. This way, both a value ("abc") and a null will map to a type the JDBC driver can understand.



来源:https://stackoverflow.com/questions/32081980/mybatis-ora-01745-invalid-host-bind-variable-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!