Following is my code effort.... I want to read first line of file(comma separated) & then create table in JavaDB but stuck here... Please someone help me how to do next????
public class DatabaseDAO {
public void FileRead(String st) throws ClassNotFoundException, SQLException, IOException{
String []tokens=null;
try{
try (FileReader fr = new FileReader("st"); BufferedReader br = new BufferedReader(fr)) {
String line=br.readLine();
while(!"\n".equals(line)){
tokens = line.split(",");
}
Class.forName("org.apache.derby.jdbc.ClientDriver");
String url="jdbc:derby://localhost:1527/SmartMiner";
try (Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/SmartMiner","PKG","diaaman")) {
Statement stmt=con.createStatement();
String sql="CREATE TABLE SmartMiner";
stmt.executeUpdate(sql);
con.close();
}
}
}
catch(IOException ioEx){
System.out.println(ioEx);
}
}
}