problem with timestamp (jdbc)
От | Jaume |
---|---|
Тема | problem with timestamp (jdbc) |
Дата | |
Msg-id | 38E9C43A.B5415CC4@dis.ulpgc.es обсуждение исходный текст |
Список | pgsql-interfaces |
hi! ExecGroup-0:err:No class found for datetime. :-? *this is the table running under postgresql 6.5.3 *+----------------------------------+----------------------------------+-------+ *| Field | Type | Length| *+----------------------------------+----------------------------------+-------+ *| cod_habitacion | int4 not null default nextval('" | 4 | *| cod_tipo_habitacion | int4 not null | 4 | *| numero | int4 not null | 4 | *| planta | int4 not null | 4 | *| observaciones | text | var | *| total_facturado | float4 | 4 | *| noche_ocupada | int4 | 4 | *| noche_libre | int4 | 4 | *| noche_bloqueada | int4 | 4 | *| ultima | datetime | 8 | *+----------------------------------+----------------------------------+-------+ * Indices: habitaciones_cod_tipo_habit_key * habitaciones_pkey */ // here is sniped code import com.codestudio.util.*; import java.util.Vector; import java.util.Date; import java.sql.*; public class Habitacion_BDImpl implements Habitacion_Int { private final int NOCHE_LIBRE_POS=8; private final int NOCHE_BLOQUEADA_POS=9; private final int ULTIMA_POS=10; private SQLManager manager = null; public Habitacion[] Recoge_Habitacion() { Habitacion habitacion = null; Vector resp = new Vector(); try { manager = SQLManager.getInstance(); }catch (PoolPropsException ex) {} Connection con = manager.requestConnection(); PreparedStatement s = null; ResultSetres = null; try { s = con.prepareStatement("SELECT * FROM "+TABLA+" WHERE cod_habitacion=?"); s.setInt(1,cod.intValue()); res = s.executeQuery(); while (res.next()) { habitacion.Set_Numero_Noches_Libre((Integer)res.getObject(NOCHE_LIBRE_POS)); habitacion.Set_Numero_Noches_Bloqueada((Integer)res.getObject(NOCHE_BLOQUEADA_POS)); /---------------> habitacion.Set_Ultima_Estancia((Date)res.getObject(ULTIMA_POS)); } } catch (SQLExceptionsqle) { sqle.printStackTrace(); } finally { try { s.clearParameters(); }catch (SQLException e) {e.printStackTrace();} manager.closeResources(s,res); manager.returnConnection(con); } Habitacion habitaciones[] = new Habitacion[resp.size()]; resp.copyInto(habitaciones); returnhabitaciones; } } // habitacion.Set_Ultima_Estancia expect a Date type ... // There are any error at compiling time but when I try to run this method this is the answer: //ExecGroup-0:err:No class found for datetime. // <----------- ? // at postgresql.Connection.getObject(Connection.java, Compiled Code) // at postgresql.jdbc2.ResultSet.getObject(ResultSet.java, Compiled Code) // at Habitacion_BDImpl.Recoge_Habitacion_Tipo(Habitacion_BDImpl.java, Compiled Code) // at ServerRMImpl.RecogeHab_Tipo(ServerRMImpl.java, Compiled Code) // at java.lang.reflect.Method.invoke(Native Method) // at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java, Compiled Code) // at sun.rmi.server.UnicastServerRef2.dispatch(UnicastServerRef2.java, Compiled Code) // at sun.rmi.transport.Transport$1.run(Transport.java, Compiled Code) // at java.security.AccessController.doPrivileged(Native Method) // at sun.rmi.transport.Transport.serviceCall(Transport.java, Compiled Code) // at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java, Compiled Code) // at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java, Compiled Code) // at java.lang.Thread.run(Thread.java, Compiled Code) // What's wrong and how can I resolve it?
В списке pgsql-interfaces по дате отправления: