Issue in dynamic nodes creatinion using java(RDBMS-Neo4j) -


below code im using generating multiple node dynamically. oracle query returning 12 rows(table names). able create 1 node here. not able created 12 nodes. pl help.

public class connect {     static graphdatabaseservice db;     public static void main(string[] args)    throws sqlexception     {         db= new embeddedgraphdatabase("d:\\neo_database\\db10" );         drivermanager.registerdriver(new oracledriver());         connection conn =drivermanager.getconnection("jdbc:oracle:thin:@localhost:1521:orcl", "hr", "hr");         statement stmt = conn.createstatement();         resultset rset = stmt.executequery("select distinct segment_name table_name,segment_type user_extents segment_type='table'");         string table="";         string segment="";         transaction tx = db.begintx();         while (rset.next()) {                    table=rset.getstring("table_name");                     segment=rset.getstring("segment_type");                      node datanode = db.createnode();             datanode.setproperty("schema", "hr");                        createandconnectnode( table, datanode,reltypes.knows );                             tx.success();         }          tx.finish();      }        private static node createandconnectnode( string name, node othernode,             relationshiptype relatiohshiptype )     {         node node = db.createnode();         node.setproperty( name, name );         node.createrelationshipto( othernode, relatiohshiptype );         system.out.println("name--------->"+name);          return node;     }      public static void registershutdownhook(final graphdatabaseservice graphdb) {         runtime.getruntime().addshutdownhook(new thread() {             @override             public void run() {                 graphdb.shutdown();             }         });     } } 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -