jdk- 1.6、os- redhat 5、driver- class12.jar、(jarとjdk lib)dbを使用しています-Oracle 10i
コード:-
public Timestamp getCurrentTimeStamp(Connection connection) throws SQLException {
Timestamp timeStamp = null;
try {
PreparedStatement ps = connection.prepareStatement(" SELECT CURRENT_TIMESTAMP FROM DUAL");
ResultSet rs = ps.executeQuery();
if (rs.next()) {
timeStamp = rs.getTimestamp("CURRENT_TIMESTAMP");
}
} catch(Exception e){}
return timeStamp;
}
一部のシステムでは正常に動作しますが、サーバーでは次の例外のみがスローされます
java.sql.SQLException: Invalid column type
at oracle.jdbc.dbaccess.DBError.
throwSqlException(DBError.java:189)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:294)
at oracle.jdbc.driver.OracleStatement.getTimestampValue(OracleStatement.java:4627)
at oracle.jdbc.driver.OracleResultSetImpl.getTimestamp(OracleResultSetImpl.java:409)
at oracle.jdbc.driver.OracleResultSet.getTimestamp(OracleResultSet.java:1649)
at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:262)
at myutils.FoursplUtils.getCurrentTimeStamp(FoursplUtils.java:131)
at NewServlet.processRequest(NewServlet.java:44)
at NewServlet.doGet(NewServlet.java:74)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
結果セットの時間関連関数のみが機能していません........(resultset.getTimestamp()、resultset.getDate())。しかし、resultset.getString()は正常に機能します...
Javaフォーラムで、オラクルのリターンタイムゾーン設定とJREタイムゾーン設定の違いが原因であると答えました...それは正しいかどうか.....またはこれをどのように解決できますか......... ... 私を助けてください.............