【求助】mysql转成oracle:无法转换为内部表示
问题:原本基于mysql没有出错、数据库换成oracle提示无法转换为内部表示...另:连接什么的都没错...
新手、求大神答疑...谢谢
servelet部分代码 //连接数据库
Mopuser mopuser = new Mopuser();
mopuser.setUsername(username);
mopuser.setPword(pword);
//处理操作
MopuserService ms = new MopuserService();
boolean flag = ms.mopuserLogin(mopuser) ;
if(flag){
mopuser = ms.findMopuserByName(username);
HttpSession session = request.getSession();
session.setAttribute("mopuser",mopuser);
response.sendRedirect("index.jsp");
}else{
response.sendRedirect("login.jsp?errstr=1");
}
index.jsp里面的部分代码:
<%
//验证登陆
String userstr,opstr;
Mopuser mopuser =(Mopuser)session.getAttribute("mopuser");
if(mopuser==null){
userstr="";
opstr="<a href='login.jsp' class='white1'>登录</a>";
}else{
userstr="亲爱的"+mopuser.getNickname();
opstr = "<a href='LogoutServlet' class='white1'>注销</a>";
}
%>
--------------------编程问答-------------------- 没有看到操作数据库的代码,也没有贴出异常信息
贴出来才能帮你分析解决 --------------------编程问答-------------------- 不好意思啊、
补上数据库操作代码:
org.icer.dbutil;里面的
public ResultSet execQuery(String sql,String[] args){
try {
PreparedStatement pstm = con.prepareStatement(sql); for(int i=0; i<args.length; i++)
pstm.setString(i+1, args[i]);
ResultSet rs = pstm.executeQuery();
return rs;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
org.icer.service; 里面的:
public Mopuser findMopuserByName(String username) {
String sql = "select * from mopuser where username=?";
String[] args = {username};
DBHelper dh = new DBHelper();
ResultSet rs = dh.execQuery(sql, args);
try {
if(rs.next()){
Mopuser mopuser = new Mopuser();
mopuser.setUid(rs.getInt(1));
mopuser.setUsername(rs.getString(2));
mopuser.setPword(rs.getString(3));
mopuser.setSex(rs.getString(4));
mopuser.setBdate(rs.getString(5));
mopuser.setCity(rs.getString(6));
mopuser.setNickname(rs.getString(7));
mopuser.setEmail(rs.getString(8));
mopuser.setTruename(rs.getString(9));
mopuser.setScore(rs.getInt(10));
mopuser.setState(rs.getByte(11));
mopuser.setIsactive(rs.getByte(12));
mopuser.setRegdate(rs.getString(14));
return mopuser; }
} catch (SQLException e) {
e.printStackTrace();
}
return null;
} --------------------编程问答-------------------- 错误代码:
java.sql.SQLException: 无法转换为内部表示
at oracle.jdbc.driver.CharCommonAccessor.getInt(CharCommonAccessor.java:147)
at oracle.jdbc.driver.T4CVarcharAccessor.getInt(T4CVarcharAccessor.java:815)
at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:896)
at org.icer.service.MopuserService.findMopuserByName(MopuserService.java:58)
at com.icer.servlet.LoginServlet.doPost(LoginServlet.java:31)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1805)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662) --------------------编程问答-------------------- 大神门...
补充:Java , Web 开发