我有MySQL 5.5盒带有以下post_start_mysql(.openshift \ action_hooks \ post_start_mysql):
echo "********MySQL_config post_start_mysql it's running."/usr/bin/mysql -h "127.8.237.2" -u "adminc5aiLd5" \
--password="bcHxwMCKLpJ4" -P 3306 \
-e 'SET NAMES "utf8"; SET CHARACTER SET utf8; SET GLOBAL character_set_client=utf8, character_set_database=utf8, character_set_results=utf8, character_set_connection=utf8, character_set_server=utf8, collation_server=utf8_general_ci; SET character_set_client=utf8, character_set_results=utf8, character_set_connection=utf8, character_set_server=utf8, collation_server=utf8_general_ci, collation_database=utf8_general_ci;'
在我的context.xml(\ webapp \ META-INF \ context.xml)中,我有:
<Resource name="jdbc/currencyexchange"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://x.x.x.x:3306/xxx?autoReconnect=true"
connectionProperties="useEncoding=true&characterEncoding=UTF-8;"
username="xxx"
password="xxx"
maxActive="100" maxIdle="30" maxWait="10000"
/>
结果:
mysql> show variables like '%character%';
+--------------------------+------------------------------------------------+
| Variable_name | Value |
+--------------------------+------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /opt/rh/mysql55/root/usr/share/mysql/charsets/ |
+--------------------------+------------------------------------------------+
我有JBossEWS 2.0盒式磁带,带有以下pre_start_jbossews(.openshift \ action_hooks \ pre_start_jbossews):
echo "*******jboss_Config pre_start_jboss it's running."
export JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Dorg.apache.catalina.connector.URIEncoding=UTF-8 -Dorg.apache.catalina.connector.useBodyEncodingForURI=true"
在我的server.xml(.openshift \ config \ server.xml)中,我有:
<Connector address="${OPENSHIFT_JBOSSEWS_IP}"
port="${OPENSHIFT_JBOSSEWS_HTTP_PORT}"
URIEncoding="UTF-8"
useBodyEncodingForURI="true"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"/>
我的web.xml(webapp \ WEB-INF \ web.xml):
<filter>
<filter-name>CharsetFilter</filter-name>
<filter-class>xx.xxx.xxx.filter.CharsetFilter</filter-class>
<init-param>
<param-name>requestEncoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharsetFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
...
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<page-encoding>UTF-8</page-encoding>
</jsp-property-group>
</jsp-config>
CharsetFilter.java:
public class CharsetFilter implements Filter
{
private String encoding;
public void init(FilterConfig config) throws ServletException
{
encoding = config.getInitParameter("requestEncoding");
if( encoding==null ) encoding="UTF-8";
}
public void doFilter(ServletRequest request,
ServletResponse response, FilterChain next)
throws IOException, ServletException
{
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
response.setCharacterEncoding("UTF-8");
next.doFilter(request, response);
}
public void destroy(){}
}
我的冬眠道具:
<util:properties id="hibernateProperties">
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<prop key="hibernate.connection.CharSet">utf8</prop>
<prop key="hibernate.connection.characterEncoding">utf8</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.show_sql">false</prop>
</util:properties>
结果如下: enter image description here enter image description here
问题出在对mysql的请求中:
.UpdateClient("update clients set name='???????'....")
如果你们中的一些人可以帮我解决这个问题,我真的很感激。
答案 0 :(得分:0)
I/AppCompatDelegate: The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's
W/EGL_emulation: eglSurfaceAttrib not implemented
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x9e23f960, error=EGL_SUCCESS
W/System.err: java.io.IOException: open failed: EACCES (Permission denied)
W/System.err: at java.io.File.createNewFile(File.java:939)
W/System.err: at java.io.File.createTempFile(File.java:1004)