Results 1 to 2 of 2
  1. #1
    iNko is offline Member
    Join Date
    Dec 2012
    Rep Power

    Default Program crashing after some time after sending data to mysql

    I have a form. After i enter all values into each field i press a button. It then saves all the data into my mysql database. After a minute or two my program crashes giving me this message:

    This is the code where i insert into the database:

    Java Code:
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
            if ((jTextField1.getText().isEmpty()) || (jTextField2.getText().isEmpty()) || (jTextField3.getText().isEmpty())) {
               jLabel4.setText("Error msg"); 
            } else {
            try {
                String sql = "INSERT INTO User (user_name_surname, user_login, user_password) values (?,?,?)";
                pst = conn.prepareStatement(sql);
                String tt1 = jTextField1.getText();
                pst.setString(1, tt1);
                String tt2 = jTextField2.getText();
                pst.setString(2, tt2);
                String tt3 = jTextField3.getText();
                pst.setString(3, tt3);
            } catch (Exception e) {
                jLabel4.setText("Error msg");
                //JOptionPane.showMessageDialog(null, "Toks pranešimas jau buvo išsiūstas pasirinktam vartotojui");
               JOptionPane.showMessageDialog(null, e);
    Do i need to "close the connection" after the submit? (if so, how?) Any suggestions at all?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: Program crashing after some time after sending data to mysql

    Log the exception, including the stack trace, and print it here (not a screenshot).
    When does this happen?
    The first call?

    You don't seem to be closing statements, which might cause a resource leak.
    What sort of application is this?
    Web app?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 1
    Last Post: 04-04-2014, 04:25 PM
  2. Help with sending data?
    By ludo0777 in forum New To Java
    Replies: 4
    Last Post: 06-06-2012, 08:19 PM
  3. Sending E-Mail from Java at certain time
    By chaitut715 in forum Advanced Java
    Replies: 4
    Last Post: 03-09-2012, 11:03 AM
  4. MySQl query taking too much time
    By jessie in forum JDBC
    Replies: 16
    Last Post: 11-11-2010, 02:09 PM
  5. Sending data trough for to two JSP pages
    By katarina.the.great in forum JavaServer Pages (JSP) and JSTL
    Replies: 7
    Last Post: 09-04-2010, 06:30 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts