If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > Read query from textfile

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-17-06, 05:52
anamikasehgal anamikasehgal is offline
Registered User
 
Join Date: Nov 2006
Posts: 13
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
Reply With Quote
  #2 (permalink)  
Old 11-17-06, 06:04
dimis2500 dimis2500 is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 02-02-07, 11:40
pakcik_kantin pakcik_kantin is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On