java - How do I read a CSV file into my local Oracle Database table? -


my goal read csv file, loading sample database table (oracle) have . far , have following java code :

    public class parsingcsv {        public static void main(string[] args) {          parsingcsv obj = new parsingcsv();         obj.run();        }          @suppresswarnings("oracle.jdeveloper.java.nested-assignment")         public void run() {          string csvfile = "c:\\users\\ibm_admin\\desktop\\work\\connectone_bancorp\\database_work\\book1.csv";         bufferedreader br = null;         string line = "";         string cvssplitby = ",";          try {              br = new bufferedreader(new filereader(csvfile));             while ((line = br.readline()) != null) {                      // use comma separator                 string[] country = line.split(cvssplitby);                  system.out.println("country [code= " + country[4]                                       + " , name=" + country[5] + "]");              }          } catch (filenotfoundexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         } {             if (br != null) {                 try {                     br.close();                 } catch (ioexception e) {                     e.printstacktrace(); /* boilerplate */ 

any tips/pointers appreciated , !

the tips be:

  1. download oracle database driver oracle driver

  2. set .jar classpath. [java setting class path]

  3. register driver , connect database [java connect oracle]

  4. execute sql "create table...." [sql create table example]

  5. for every line read sql = "insert into..." [sql insert example]

for every step if need more example , advice, suggest google use [] tags search


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -