我用下面的方法转换后存还是乱码
<%!
public String toChinese(String strvalue){
try{
if(strvalue==null)
return null;
else{
strvalue=new String(strvalue.getBytes("ISO8859_1"),"GBK");
return strvalue;
}
}catch(Exception e){
return null;
}
}%>
还有什么别的方法吗?我想是不是连接池没有配好
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/feaket?username=root;password=sa;useUnicode=true;characterEncoding=GB2312</value>
</parameter>
<%!
public String toChinese(String strvalue){
try{
if(strvalue==null)
return null;
else{
strvalue=new String(strvalue.getBytes("ISO8859_1"),"GBK");
return strvalue;
}
}catch(Exception e){
return null;
}
}%>
还有什么别的方法吗?我想是不是连接池没有配好
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/feaket?username=root;password=sa;useUnicode=true;characterEncoding=GB2312</value>
</parameter>
解决方案 »
- java应用程序如何访问局域网内oracle数据库
- 希望大家进来帮帮忙!顺便谈谈关于菜单分配权限方面问题!
- java.net.SocketException: Connection timed out:could be due to invalid address
- 问个和tomcat 大小写有关的问题
- 数据库连接池
- 当所查记录为空的时候报错[Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation for the current cursor position.
- 关于上传文件更新数据库问题(急)
- 我有个String型的日期,怎么做加法
- <select name="descrip" > </select>的问题~~~
- 太奇怪了,jsp中的rs数据集其他的字段都能取出来,但就是有一两个字段取不出来,这是为什么?
- jdbc驱动问题。
- 如何让从数据库中抓出来的数据在页面上都显示成大写!高手赐教!
public String getStr(String str) {
try {
String temp_p = str;
byte[] temp_t = temp_p.getBytes("ISO8859-1");
String temp = new String(temp_t);
return temp;
} catch(Exception e) {
}
return null;
}
%>
还有转换成其他的码因为可能你的mysql不支持gb2312
那你就试试utf-8
还有转换成其他的码因为可能你的mysql不支持gb2312
那你就试试utf-8
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/feaket?username=root;password=sa;useUnicode=true;characterEncoding=GB2312</value>
</parameter>