Tag Archives: Cause: java.sql.SQLException:

[How to Fix]java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x98\x82\xF0\x9F…’

java.sql.SQLException : Incorrect string value: ‘\xF0\x9F\x98\x82\xF0\x9F…’

Problem:
because the emoticons stored in MySQL database string are not compatible with 4-byte Unicode.

Solution:
use the third-party jar to import and store after transformation.

POM introduction:

		 <!-- Expression Switching -->
        <dependency>
            <groupId>com.github.binarywang</groupId>
            <artifactId>java-emoji-converter</artifactId>
            <version>0.1.1</version>
        </dependency>

Specific conversion method:

	String content = "\xF0\x9F\x98\x82\xF0\x9F";
  	EmojiConverter emojiConverter = EmojiConverter.getInstance();
    content= emojiConverter.toAlias(content);//Escaping chat content
    System.out.println(content);

Cause: java.sql.SQLException: invalid column type: 1111 Error [How to Fix]

Warming: Servlet.service() for servlet [spring] in context with path [/*****] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='ENTERPRISE_NAME', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #13 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: Invalid column type: 1111] with root cause
java.sql.SQLException: Invalid column type: 1111
	at oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:3978)

Screen:

When inserting the name,ENTERPRISE_NAME passes null and mybatis returns an error.
The solution is: