gpt4 book ai didi

java - XAMPP Mysql packet too big异常如何解决

转载 作者:行者123 更新时间:2023-11-29 00:07:50 26 4
gpt4 key购买 nike

   private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Connection connection = null;
String connectionURL = "jdbc:mysql://localhost:3306/vivek";


ResultSet rs = null;


PreparedStatement psmnt = null;

try {


Class.forName("com.mysql.jdbc.Driver").newInstance();


connection = DriverManager.getConnection(connectionURL, "vivek", "voyage88");

**psmnt = connection.prepareStatement("insert into save_image(customerid,customername,cnumber,cimage,address,idproof1,idproof2,idc1,idc2,description,ref name,refcnumber,refaddress,refdescription,dates) "
+ "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");**


String ci = customerid.getText();
psmnt.setString(1, ci);
String cn= customername.getText();
psmnt.setString(2, cn);
String cc= customernumber.getText();
psmnt.setString(3, cc);
is = new FileInputStream(new File(filename));
psmnt.setBinaryStream(4, is);

String ca= address.getText();
psmnt.setString(5, ca);
String id1 = idproof1.getText();
psmnt.setString(6, id1);
String id2 = idproof2.getText();
psmnt.setString(7, id2);
String idcc1=id11.getSelectedItem().toString();
psmnt.setString(8, idcc1);
String idcc2=id22.getSelectedItem().toString();
psmnt.setString(9, idcc2);
String cd= description.getText();
psmnt.setString(10, cd);
String rn= refname.getText();
psmnt.setString(11, rn);
String rc= refcontactnumber.getText();
psmnt.setString(12, rc);
String ra=refaddress.getText();
psmnt.setString(13, ra);
String rd=refdescription.getText();
psmnt.setString(14, rd);
String dte=dtess.getText();
psmnt.setString(15, dte);





int s = psmnt.executeUpdate();
if (s > 0) {
System.out.println("Records sucessfully Added !");

JOptionPane.showMessageDialog(rootPane, "Records sucessfully Added");
} else {
System.out.println("check given records:Records Not Added");
}
connection.close();
psmnt.close();
}
catch (Exception ex) {
System.out.println("Found some error : " + ex);
}
}

我尝试使用 Java 向 XAMPP Mysql 插入值,但出现错误 com.mysql.jdbc.packetTooBigExcetion:packet for query is too large(3548177>1048576) - 您可以通过设置 max_allowed_pa​​cket 在服务器上更改此值' 变量

我将 my.ini 设置从 1mb 更改为 32mb,但错误仍然存​​在。

最佳答案

请查看此链接。尝试将您的尺寸增加到 1000,这取决于您的尺寸

http://help.hannonhill.com/kb/common-error-messages/mysql-packet-for-query-is-too-large

另请参阅此链接以获取想法

http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html

关于java - XAMPP Mysql packet too big异常如何解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26686735/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com