Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE DATES(
- DT DATETIME,
- TS TIMESTAMP,
- );
- INSERT INTO DATES(DT, TS) VALUES(NOW(), NOW());
- SELECT * FROM DATES;
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/MYDB","root","pswrd");
- Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
- ResultSet srs = stmt.executeQuery("SELECT * FROM DATES");
- }
- catch(Exception e){
- e.printStackTrace();
- JOptionPane.showMessageDialog(null, "Error.");
- }
- JOptionPane.showMessageDialog(null, "Date & Time: " + <<I want the values here>>);
Add Comment
Please, Sign In to add comment