Results 1 to 4 of 4
  1. #1
    yiantzi is offline Member
    Join Date
    Jan 2011
    Rep Power

    Unhappy Derby Mystery..!!!!

    Could anyone please advice me about a strange behavior of derby Database?

    1. I have created a table in an Embedded Derby Database with the name "PC"
    2. In this table there is a field with the name "EMPID" type of INT, and it is accepting null entries.
    3. I have created the dbconnection
    dBconnection = DriverManager.getConnection(connString + database,
    user, password);
    4. I have created a Result Set and a Prepared Statement as well:
    private PreparedStatement readXrPc;
    private ResultSet resultSet;
    5. Then I created the initialize prepare statement:
    readXrPc = dBconnection.prepareStatement("SELECT * FROM
    6. Then I created a method in order to read the records I want..
    public ArrayList<PcClass> readEmpIdPc(int ypid){
    readXrPc.setInt(1, ypid);
    resultSet = readXrPc.executeQuery();......
    7. I called the method with ypid=25 (I have at least two entries with this ID in my table)..

    Nothing happens.. the result set is empty..
    When i run the same SQL qyery in the SQL editor everything is Ok and i have the correct results..

    I changed the select statement to "SELECT * FROM APP.PC" and I override the method "toString" in roder to see what entries we have in the result set for the field EMPID..

    I saw that when this field has one entry (everything not only the 25 i am looking for) the result is the number 1..
    And when there is no entry (null) the result is 0...

    Could anyone knows what is going wrong here..?


  2. #2
    Andri_JT is offline Member
    Join Date
    Jan 2011
    Rep Power


    just a newbie also...
    but in my case...i have to connect using SERVICES tab.
    when will display as follows:
    2011-01-22 21:37:05.044 GMT : Security manager installed using the Basic server security policy.
    2011-01-22 21:37:10.046 GMT : Apache Derby Network Server - - (802917) started and ready to accept connections on port 1527

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Rep Power


    Well, in your create table statement, did you designate the column as "NOT NULL"?

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


    Can you show us the code where to loop through the resultset?

Similar Threads

  1. Derby.jar
    By wulfgarpro in forum New To Java
    Replies: 0
    Last Post: 10-02-2010, 06:22 AM
  2. derby DB problem
    By edi.gotieb in forum Forum Lobby
    Replies: 8
    Last Post: 05-17-2010, 01:45 PM
  3. need some derby tips:
    By kulangotski in forum Advanced Java
    Replies: 4
    Last Post: 03-09-2009, 06:09 PM
  4. using if in derby
    By suhaib1thariq in forum JDBC
    Replies: 0
    Last Post: 01-25-2009, 05:46 AM
  5. Is there a problem with Derby?
    By orion_mcl in forum Advanced Java
    Replies: 0
    Last Post: 08-10-2007, 05:35 AM

Posting Permissions

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