java - how to connect and insert map keys and values into derby database? -


i have java program , produces output follows :

termname :docname : termcount

forexample termname hello , docname :2 , termcount :4

hello:doc1:4 ..... ......

i stored values in map. here following program

public class tuple {                public static void main(string[]args) throws filenotfoundexception, unsupportedencodingexception, sqlexception, classnotfoundexception, exception{          file file2 = new file("d:\\logs\\tuple.txt");          printwriter tupled = new printwriter(file2, "utf-8");          list<map<string, integer>> list = new arraylist<>();          map<string, integer>map= new hashmap<>();;          string word;      //iterate on documents      (int = 1; <= 2; i++) {          //map = new hashmap<>();          scanner tdsc = new scanner(new file("d:\\logs\\afterstem" + + ".txt"));          //iterate on words          while (tdsc.hasnext()) {              word = tdsc.next();              final integer freq = map.get(word);              if (freq == null) {                  map.put(word, 1);              } else {                  map.put(word, map.get(word) + 1);              }          }          list.add(map);      }      // tupled.println(list);       //tupled.close();      //print result                         int documentnumber = 0;      (map<string, integer> document : list) {          (map.entry<string, integer> entry : document.entryset()) {              documentnumber++;              //system.out.println(entry.getkey() + ":doc"+documentnumber+":" + entry.getvalue());              tupled.print(entry.getkey());              tupled.print(":doc:");              tupled.print(integer.tostring(documentnumber));              tupled.print(",");              tupled.println(entry.getvalue());                                      }          //documentnumber++;      }      tupled.close();

now want store values derby database of neatbeans. how able ?


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -