• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sql newbie

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Made a sql database, can use select and insert. Made the database from notepad and renamed it .sql and works fine (mysql). How do I insert new rows into the database AND have the new rows saved in my .SQL file for permanent storage? Basically what i am saying is i can insert stuff but it does not save it for future use or can it??? Thanks in advance
roba dbnewbie
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob,
Welcome to JavaRanch!

If you are inserting through a Java program, you can write code to insert the row via JDBC and append it to your file using Java's I/O APIs. If you inserting at the mysql command line, you are going to have to manually add it to the file each time. Although I suppose you could write an operating system batch file to do it for you.
 
rob armstrong
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok sounds like i will have to use java to do it.
Ill look in the api's there than. Hopefuly that answers my other question... I have used the PrintStream object but notised it does not let you add to files it only saves a new copy each time. example .. Program makes a 'A' than tommorow you want to add a 'B'. load up the file and it just shows a 'B' no more 'A'. So i assume there is another object for adding to files. Just like the save button would do in 'NOTEPAD' or most other applications.
roba
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob,
Take a look at the FileWriter class. It has a constructor for appending to a file. If you have any more questions on writing to files, please post a new question in our I/O forum.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic