Results 1 to 4 of 4
Thread: Derby Mystery..!!!!
- 01-22-2011, 10:37 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 1
- Rep Power
- 0
Derby Mystery..!!!!
Hi
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
APP.PC WHERE EMPID=?");
6. Then I created a method in order to read the records I want..
public ArrayList<PcClass> readEmpIdPc(int ypid){
try{
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..?
:(:(:(
- 01-23-2011, 06:03 PM #2
Member
- Join Date
- Jan 2011
- Posts
- 10
- Rep Power
- 0
just a newbie also...
but in my case...i have to connect using Netbeans..in SERVICES tab.
when connected..it 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 - 10.5.3.0 - (802917) started and ready to accept connections on port 1527
- 01-23-2011, 09:36 PM #3
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Well, in your create table statement, did you designate the column as "NOT NULL"?
- 01-24-2011, 11:59 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Similar Threads
-
Derby.jar
By wulfgarpro in forum New To JavaReplies: 0Last Post: 10-02-2010, 05:22 AM -
derby DB problem
By edi.gotieb in forum Forum LobbyReplies: 8Last Post: 05-17-2010, 12:45 PM -
need some derby tips:
By kulangotski in forum Advanced JavaReplies: 4Last Post: 03-09-2009, 05:09 PM -
using if in derby
By suhaib1thariq in forum JDBCReplies: 0Last Post: 01-25-2009, 04:46 AM -
Is there a problem with Derby?
By orion_mcl in forum Advanced JavaReplies: 0Last Post: 08-10-2007, 04:35 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks