import java.sql.*; public class test1 { public static void main(String[] args) throws Exception { String URL = "jdbc:mysql://localhost/test"; String USER = "root"; String PASS = ""; String DRIVER = "com.mysql.jdbc.Driver"; Connection conn = null; Statement batch = null; String sql = "SELECT t FROM test4"; ResultSet rs; Statement stmt; Time foo; DriverManager.registerDriver((Driver) Class.forName(DRIVER).newInstance()); conn = DriverManager.getConnection(URL, USER, PASS); batch = conn.createStatement(); batch.addBatch("drop table if exists test4"); batch.addBatch("create table test4 (t time)"); batch.addBatch("insert into test4 values ('100:00:00')"); batch.addBatch("insert into test4 values ('-1:00:00')"); batch.addBatch("insert into test4 values ('-10:00:00')"); batch.addBatch("insert into test4 values ('-100:00:00')"); batch.executeBatch(); stmt = conn.createStatement(); rs = stmt.executeQuery(sql); for (; rs.next(); ) foo = rs.getTime("t"); } }