I am just wondering if this is a correct way to execute multiple query from a text file.
Connection conn = Utility.getConnection();
Statement stmt = null;
try{
JFileChooser chooser = new JFileChooser();
int returnVal = chooser.showOpenDialog(chooser);
if(returnVal == JFileChooser.APPROVE_OPTION) {
String fileName=chooser.getCurrentDirectory().toString()+File.separator+chooser.getSelectedFile().getName();
FileInputStream fstream = new FileInputStream(fileName);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
if(conn != null)
stmt = conn.createStatement();
while ((strLine = br.readLine()) != null) {
if(stmt !=null){
int rc=stmt.executeUpdate(strLine);
if(rc == 0)
System.out.println("executing: "+strLine);
}
}
stmt.close();
conn.close();
in.close();
}
}catch (Exception e){
e.printStackTrace();
}