• Post Reply Bookmark Topic Watch Topic
  • New Topic

Read from a file and write to database  RSS feed

 
Jsandy Sandyj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
1) How do I read records from a text file and write to database ?
Each record has 50 columns seperated by a delimeter #.
please help me with the code as soon as possible.

Thanks
 
Angel Dobbs-Sciortino
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a pretty general question. Is there something specific you're having trouble with the text file or the database access?
Angel
[ January 15, 2004: Message edited by: Angel Dobbs-Sciortino ]
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this a school assignment???
Try this link for reading a text file:
http://davinci.newcs.uwindsor.ca/W2003/60-254/tutorials/text_io.html
I don't recommend using StringTokenizer to parse the lines--instead, check out the String split method.
Then, if you're using JDBC, check out this:
http://java.sun.com/docs/books/tutorial/jdbc/basics/
If you're just sending SQL statements in Java, then look around for examples like this:
http://forum.java.sun.com/thread.jsp?forum=48&thread=144447
If you don't even know SQL, then check out the multitudes of online tutorials:
http://www.sqlcourse.com/
http://www.w3schools.com/sql/default.asp
http://sqlzoo.net/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!