Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    13

    Unanswered: Read query from textfile

    I have a project named "Design of execution manager in distributed database". I have stored a query(SQL) in text file. Can neone tell me a java code inorder to extraxt the query from the text file such as table name, attributed etc..plz help immediately

  2. #2
    Join Date
    Jan 2005
    Posts
    362

    File

    How is this file?
    You can use I/O classes.
    You may also use a .xml file and read it from Java.
    Dimis

  3. #3
    Join Date
    Jul 2004
    Posts
    62
    i used java csvreader and read line by line, or just normail java io library

    CSVreader
    sample.sql
    INSERT INTO.....;
    UPDATE TABNNLE ....;

    in java

    PreparedStatement pst=null;
    Connection conn=
    .....
    CsvReader reader = new CsvReader("c:/sample.sql");
    while (reader.readRecord())
    {
    String sql = reader.get(0);
    pst.executeQuery(sql);


    // perform program logic here

    }

    don't forget the try and catch block and finnally block

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •