import java.math.BigDecimal; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; public class Main { public static void main(String[] argv) throws Exception { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbctutorial", "root", "root"); String sql = "INSERT bigdecimal VALUES(?,?)"; PreparedStatement prest = con.prepareStatement(sql); prest.setString(1, "D"); BigDecimal b = new BigDecimal("111111111111111111111111111111111"); prest.setBigDecimal(2, b); prest.executeUpdate(); } }