Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help! Java Newbie  RSS feed

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create an application that a user can key in a order description and click on add, change or delete. I haven't got a clue on how to do this. I have the GUI part of it down, but I'm lost when it comes to adding , changing, and deleting records in a file. Could someone please give me a couple of hints, or a good reference?
Thanks.
[This message has been edited by Jennifer Sohl (edited March 19, 2001).]
 
lee dalais
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there
are u wanting to store the records in a normal text file or a database?
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know how to do both. In the very near future we will be attempting to access records from an AS/400 database so I will definitely need to know how to do that. Right now, I'm just trying to "feel out" java and I thought it might be easier to use a text file rather than our whole database.
Thanks for the reply!
 
lee dalais
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Jennifer
adding data to the file is the easy part:
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.dat")));
out.println("data");//this gets printed to the file foo.dat
to change data in a file u'll need to use the RandomAccessFile API, where u can goto a particular position in a file and to delete probably use the RandomAccessFile API.
now to access a database, it's a bit more complex,
here's a url
http://developer.java.sun.com/developer/onlineTraining/Database/JDBCShortCourse/index.html
and also look around the net for other tutorials.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!