Department_Table という名前の「Jtable」を作成しました。SQL クエリを使用して、データベース テーブルの内容を Jtable に入力しようとしています。
正常に完了しましたが、データベース テーブルのタイムスタンプ列が正しく表示されません。このプログラムの何が問題なのかを教えてください。
コード:
public void UpdateTable()
{
try
{
Connection conn=Address.getOracleConnection();
String sql="Select * from department";
/*
Using to_char my statement looks like this and it works
String sql="Select department_id,name,to_char(created_on,'dd/MM/yyyy HH24:MI:SS') from department";
*/
PreparedStatement pst=conn.prepareStatement(sql);
ResultSet res=pst.executeQuery();
Department_Tabel.setModel(DbUtils.resultSetToTableModel(res));
}
catch(Exception e)
{
Notify.showMessageDialog(null,""+e+"","Error Generating Table",Notify.ERROR_MESSAGE);
}
}
出力:
departmentid name createdon
1 name1 oracle.sql.TIMESTAMP@19eda2c
2 name2 oracle.sql.TIMESTAMP@59a34