• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problems reading in from db file, please advise.

 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I've been having trouble for some time now reading in the db file via the RandomAccessFile object.

In the output below the server kicks off, checks the cookie and reads in the schema details and sets the data start pointer.

[output]
startServer:
[exec] Starting URLyBird Broker Service
[exec] System ready.
[exec] 4, name, 64
[exec] 8, location, 64
[exec] 4, size, 4
[exec] 7, smoking, 1
[exec] 4, rate, 8
[exec] 4, date, 10
[exec] 5, owner, 8
[exec] total fields: 7
[exec] record declared
[exec] data start ptr: 74
[/output]

Now the client invokes a remote method which simply trys to get the first record. the function reads each element into a String[], see below.



The output shows the first 3 elements are read OK. Then its all starts going wrong, the smoking field value 'Y' is missed then picked up in the next array element causing further problems, WHY WHY WHY

[output]
startClient:
[exec] Service: rmi://127.0.0.1:1099/URLyBird_BROKER_SERVICE
[exec] Record: Palace
[exec] Record: Smallville
[exec] Record: 2
[exec] Record:
[exec] Record: Y$150.00
[exec] Record: 2005/07/2
[exec] Record: 7
[/output]


Thanks in advance!

[ November 17, 2004: Message edited by: James Clinton ]
[ November 17, 2004: Message edited by: James Clinton ]
 
Anton Golovin
Ranch Hand
Posts: 530
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, James.

The same thing happened to me, too, when I was reading a record. I forgot that the record is preceeded by a byte flag. Putting in a line to read it should solve the problem. I was quite confused over this until I re-read the instructions, then it got solved.

Hope this helps.
[ November 17, 2004: Message edited by: Anton Golovin ]
 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, cracked it - seems so dam obvious now
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic