import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class ExperimentDecimal { public static void main(String[] args) throws SQLException { Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String db = "somedb"; String driver = "com.mysql.jdbc.Driver"; String user = "root"; String pass = "somepwd"; try { Class.forName(driver); } catch (Exception e) { e.printStackTrace(); } con = DriverManager.getConnection(url + db, user, pass); Statement s = con.createStatement(); s.execute("DROP TABLE IF EXISTS table_1"); s.execute("DROP TABLE IF EXISTS table_2"); s.execute("CREATE TABLE table_1(test_decimal DECIMAL(10,3))"); for(int i=0;i<10000;i++){ s.execute("INSERT INTO table_1 (test_decimal) VALUE('123456.123')"); } s.execute("CREATE TABLE table_2(test_decimal DECIMAL(14,3))"); for(int i=0;i<10000;i++){ s.execute("INSERT INTO table_2 (test_decimal) VALUE('12345671234.123')"); } } }