Hello Everybody: Still I am doing preliminary work. I am trying to see data from db.db. Before changing deprecated methods I was getting all database information. I changed deprecated from readRecord and writeRecord methods as below. readRecord rv[i] = new String(buffer, 0, offset, description[i].getLength()); // Deprecated rv[i] = new String(buffer, 0, description[i].getLength(), "UTF-8"); //I changed to this. writeRecord newData[i].getBytes(0, toCopy, buffer, offset); // Deprecated newData[i].getBytes("UTF-8"); // I changed to this. Now my ouputs are messed up. What is the problem? Any response highly appreciated. Thank you. BK
No Mark no! They are not. I had following output when I did not change any deprecated method. BTW I am showing only one record. Record numer# 1 Flight number = SA001 Origin airport = SFO Destination airport = DEN Carrier = SpeedyAir Price = 400 Day = Sun Time = 13:40 Duration = 20m Available seats = 50 AFTER: Record numer# 1 Flight number = SA001SFO Origin airport = SA001SFO Destination airport = SA001SFO Carrier = SA001SFO Price = SA001SFO Day = SA001SFO Time = SA001SFO Duration = SA001SFO Available seats = SA001SFO Zuses! what is this? Where is price, day, and time? I am lost. Any help please. BK
Let me guess, your outputs have all these boxes trailing the data.
just worked on this yesterday. according to javadoc of the old methods, it uses ASCII encoding. So I just continued using ASCII encoding with the non-deprecated methods. You also need to be aware that UTF-8 uses variable length encoding. Good luck...
Look at Terry's response in this thread http://www.javaranch.com/ubb/Forum25/HTML/000917.html There is your answer. Actually probably not your complete answer. It will come in handy when you want to save. But your data looks like it is printing the first two fields concatenated together, and not looking at the other fields. Here is my read code that I used, and it works for me: rv[i] = new String(buffer, offset, description[i].getLength()).trim(); offset += description[i].getLength(); It looks like the difference between what you are using and hwta I used is that I removed the 0, and you removed the offset variable. Don't worry that I don't have the encoding in my version, either way on that is fine Mark [This message has been edited by Mark Spritzler (edited November 08, 2001).] [This message has been edited by Mark Spritzler (edited November 08, 2001).] [This message has been edited by Mark Spritzler (edited November 08, 2001).]
Joined: Sep 19, 2001
Thanks Mark, it is working. I have clear picture of database now. I do not know what should I do next? I think I should go for GUI, pull out information from data base and populate it. Then only worry about lock, unlock, criteriaFind, RMI stuff. I got do lot of RMI homework too. Thanks again for your help. BK
That's a tough question. I myself started on the RMI, Locking, CriteriaFind and server first, then the GUI. But it did take me some time to get the server close to right before I could do any GUI stuff, and then when I started on the GUI, seeing more stuff I needed tofix on the server. I think the best answer, is to think of what you can get handle on first, what will give you the best view of the overall picture. Good Luck Mark