Hello:

TABLE NAMES : /////////////////////////////////////////: :

TABLE NAMES : 10.6.2.1 - (999685): :

TABLE NAMES : Apache Derby: :

TABLE NAMES : Apache Derby Embedded JDBC Driver: :

TABLE NAMES : 10.6.2.1 - (999685): :

TABLE NAMES : /////////////////////////////////////////: :


Hello I have a problem understanding why my Prepared Statement is failing when I try to insert data into the
payee_available table. It just will not put data in the table.


I have inserted the exact same data (data types happened to match) into a similar table
Using code exactly as shown below for the payee_available table but I connected to
The instructor_available table instead. It all worked perfect. But I change the connection back to the
payee_available table and it will not insert the same data.

Is there an obvious mistake I am missing?

There is no error there is just not a response concerning the ps.executeUpdate();
it finds the prepared statement in the xml and prints it out as shown below then it just will not insert the records.

other prepared statements run good payee_available is the only problem.


The program is designed to insert an unlimited number of records. After it inserts the data shown below it
will return and build the next set and keep going intill it is done. All The other prepared statements do this but the
payee_available ps.executeUpdate will not insert the first one.

If anyone can think of what the problem might be it would be appreciated.
Thanks for your time.

The payee_available insert method of DAO:

//______________________________________insert___________________________________
    //______________________________________insert___________________________________
    public boolean primaryInsertPayeeAvailable() throws FileNotFoundException, IOException, ...{

        boolean bInsert = true;
        setTableName(tableName);
       
                close(conn, ps);
        try {
            conn = connect();<----I changed to connect to instr_available and changed the query and it will insert perfectly.
        } catch (InterruptedException ex) {
            Logger.getLogger(PayeeAvailableSupplementalDAO.class.getName()).log(Level.SEVERE, null, ex);
        }
              
            payeeAvailableUser = MasterRegisterForm.payeeAvailableBean;

            
            ps = (PreparedStatement) conn.prepareStatement(
                    ModelUtils.getXMLResource("insertPayeeAvailable"));<------query that changed

            String payee = payeeAvailableUser.getPayeeUid();
            String student = payeeAvailableUser.getStudentUid();
            Date startDate = payeeAvailableUser.getAvailableStartDate();
            Date endDate = payeeAvailableUser.getAvailableEndDate();
            Time startTime = payeeAvailableUser.getAvailableStartTime();
            Time endTime = payeeAvailableUser.getAvailableEndTime();


            ps.setString(1, payee);
            ps.setString(2, student);
            ps.setDate(3, (java.sql.Date) startDate);
            ps.setDate(4, (java.sql.Date) endDate);
            ps.setTime(5, (java.sql.Time) startTime);
            ps.setTime(6, (java.sql.Time) endTime);


           [B] STOPS HERE AND INSETS NOTHING IN FACT IT DOES NOT EVEN PRINT THIS SYS OUT: \n");[/B]


             ps.executeUpdate();
           
                close(conn, ps);
           
        return bInsert;
    }




[B]related output:[/B]

OUTPUT


The form collects the data (strings)

payee1: [Ljava.lang.String;@11ea3fc[+0+]: 

stu1: [Ljava.lang.String;@11ea3fc[+1+]: 

2011-09-05: [Ljava.lang.String;@11ea3fc[+2+]: 

2011-09-05: [Ljava.lang.String;@11ea3fc[+3+]: 

16:00:00.000: [Ljava.lang.String;@11ea3fc[+4+]: 

17:00:00.000: [Ljava.lang.String;@11ea3fc[+5+]:

OUTPUT

The payeeAvailableBean is loaded with:

payee1: payee : 

stu1: student : 

2011-09-01: startDate : 

2011-09-01: endDate : 

16:00:00: startTime : 

17:00:00: endTime :

OUTPUT


Insert the data into payee_available:

CLASS 
public class PayeeAvailableSupplementalDAO extends ConnectPayeeAvailableDAO {: 
 --> in public boolean primaryInsertPayeeAvailable() var: xxxxxxxxx : xxxxxxxx<-- 

   INSERT INTO payee_available(
    payee_uid,
    stu_uid,
    available_start_date,
    available_end_date,
    avalable_start_time,
    available_end_time)
    VALUES (?, ?, ?, ?, ?, ?)

OUTPUT

Created payee_available table when db was built:

CLASS 
public class PayeeAvailableSupplementalDAO extends ConnectPayeeAvailableDAO {: 
 --> in public boolean primaryInsertPayeeAvailable() var: xxxxxxxxx : xxxxxxxx<-- 

    CREATE TABLE payee_available(
    record_num SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1,INCREMENT BY 1),
    payee_uid VARCHAR(70),
    stu_uid VARCHAR(70),    
    available_start_date DATE,
    available_end_date DATE,
    available_start_time TIME,
    available_end_time TIME
    )

OUTPUT

Confirm Created the table payee_availble

--->: installer.execute() : var: installer.execute() <-----

TABLE NAMES : /////////////////////////////////////////:  : 

TABLE NAMES : 10.6.2.1 - (999685):  : 

TABLE NAMES : Apache Derby:  : 

TABLE NAMES : Apache Derby Embedded JDBC Driver:  : 

TABLE NAMES : 10.6.2.1 - (999685):  : 

TABLE NAMES : /////////////////////////////////////////:  : 

TABLE NAMES : ADMIN:  : 

TABLE NAMES : ADMIN_AVAILABLE:  : 

TABLE NAMES : BOOKING:  : 

TABLE NAMES : INSTRUCTOR:  : 

TABLE NAMES : INSTRUCTOR_STUDENT_MAPPING:  : 

TABLE NAMES : INSTRUMENT:  : 

TABLE NAMES : INSTR_AVAILABLE:  : 

TABLE NAMES : LOCATION:  : 

TABLE NAMES : LOCATION_AVAILABLE:  : 

TABLE NAMES : NORM_AVAILABLE:  : 

TABLE NAMES : PAYEE:  : 

[b]TABLE NAMES : PAYEE_AVAILABLE:  : <-------------------[b]

...
....
......

OUTPUT

Describe the payee_available table

CLASS 
 JMenuControlAdmin: 
 public void actionsAvailabilityActions() : 12: int count : 

name: RECORD_NUM
name: PAYEE_UID
name: STU_UID
name: AVAILABLE_START_DATE
name: AVAILABLE_END_DATE
name: AVAILABLE_START_TIME
name: AVAILABLE_END_TIME
value: SMALLINT
value: VARCHAR
value: VARCHAR
value: DATE
value: DATE
value: TIME
value: TIME




CLASS 
public class MasterRegisterTab extends MasterForm implements ActionListener, java.io.Serializable {: 
 : true PAYEE_AVAILABLE : LoginInfo.bAdmin : tableName

OUTPUT

display the columns in the JTable and it return nothing but an empty table:

CLASS 
public class ConnectPayeeAvailableDAO extends MasterForm implements PayeeAvailableDAO {: 
 --> in public ResultSet displayPayeeAvailable(payee1) var:(String aPayee):<-- 
 : displayPayeeAvailable : SELECT
    payee_uid,
    stu_uid,
    available_start_date,
    available_end_date,    
    available_start_time,
    available_end_time
    FROM payee_available
    WHERE payee_uid=?

Recommended Answers

All 3 Replies

Then you are getting an exception on one of those set lines that you are seemingly ignoring or you would have provided the exeption.

Nope: no exceptions but thanks I happened to find a mis-spelled key in the xml.
it was hard to find. It works now .

Nope: no exceptions but thanks I happened to find a mis-spelled key in the xml.
it was hard to find. It works now .

And I can guarantee that that was causing an exception.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.