Click here to Skip to main content
15,915,600 members
Home / Discussions / Database
   

Database

 
GeneralSql transaction log format Pin
jspano1-May-03 7:07
jspano1-May-03 7:07 
GeneralChecking Query Progress Pin
perlmunger30-Apr-03 4:31
perlmunger30-Apr-03 4:31 
GeneralInstall packages for serversoftware. Pin
Jonas Follesø30-Apr-03 1:35
Jonas Follesø30-Apr-03 1:35 
GeneralRe: Install packages for serversoftware. Pin
Rein Hillmann1-May-03 5:58
Rein Hillmann1-May-03 5:58 
QuestionCan execute() return both recordset and output parameters Pin
TianYang29-Apr-03 22:34
TianYang29-Apr-03 22:34 
AnswerRe: Can execute() return both recordset and output parameters Pin
andyharman30-Apr-03 12:19
professionalandyharman30-Apr-03 12:19 
GeneralCustom view for a datafield Pin
ssnkh29-Apr-03 20:14
ssnkh29-Apr-03 20:14 
GeneralSQLJ with JTree Plz HELP Pin
sharathkv12329-Apr-03 17:02
sharathkv12329-Apr-03 17:02 
I am doing a project in SQLJ and have the source as below:

This code will construct a tree structure from two SQL query using the connect by ... PRIOR statements.
The first SQL query will create the parent.
The Second SQL query will create the childern based on the parent value.A parameter is passed from Query1 to Query2 to establish a relationship between the parent and the child.
My problem now is to construct a Tree using JTree in java based on the above results of the SQL query.i,e the parent & children hierarchy has to be the same. I have tried to use a Hashtable but I am finding it vey difficult.IF SOMEONE HAS A SOLUTION, PLEASE HELP ME WITH AN EXAMPLE.


import java.sql.SQLException;
import oracle.sqlj.runtime.Oracle;
import sqlj.runtime.ref.DefaultContext;
import java.util.*;

#sql iterator iter1(String id,String fdn,int level);
#sql iterator iter2(String clli);

public class GetTree2
{
public GetTree2(String user_name,String password) throws SQLException
{
new TpSess1(user_name,password);
{
usingNamed();
}
finally
{
Oracle.close();
}
}

public GetTree2() throws SQLException
{
new TpSess1();
try
{

usingNamed();
}
finally
{
Oracle.close();
}
}
public static void main(String args[]) throws SQLException
{
new GetTree2(args[0],args[1]);
}
public void usingNamed() throws SQLException
{
iter1 it1=null;
iter2 it2=null;
String temp=null;

String pare1=null;
String par2=null;
String pare3=null;

String strcll1=null;
String strcll2=null;
String strcll3=null;

Vector all = new Vector();

Hashtable lev1 = new Hashtable();
Hashtable lev2 = new Hashtable();
Hashtable lev3 = new Hashtable();
Hashtable lev4 = new Hashtable();

Hashtable cll1 = new Hashtable();
Hashtable cll2 = new Hashtable();
Hashtable cll3 = new Hashtable();
Hashtable cll4 = new Hashtable();

#sql it1={select id,fdn,level from groups connect by prior fdn=parent_fdn
start with fdn='/' };
while(it1.next())
{
all.addElement(it1.id());
switch(it1.level())
{
case 1: lev1.put(all.elementAt(0),it1.id());
pare1 = it1.id();
break;
case 2: lev2.put(pare1,it1.id());
par2 = it1.id();
break;
case 3: lev3.put(par2,it1.id());
pare3 = it1.id();
break;
case 4: lev4.put(pare3,it1.id());
break;
}
temp=it1.fdn();
#sql it2= {select clli from nes where parent_fdn=:temp order by clli };
while(it2.next())
{
switch(it1.level())
{
case 1: cll1.put(all.elementAt(0),it2.clli());
break;

case 2: strcll2 = it1.id();
cll2.put(strcll2,it2.clli());
break;
case 3: strcll3 = it1.id();
cll3.put(strcll3,it2.clli());
break;
case 4: strcll4 = it1.id();
cll4.put(strcll4,it2.clli());
break;
}
}
}
it1.close();
it2.close();
}
}

GeneralGet parameter that generated by Refresh() Pin
TianYang28-Apr-03 22:21
TianYang28-Apr-03 22:21 
GeneralRead Only Transactions Pin
Patje28-Apr-03 22:08
Patje28-Apr-03 22:08 
GeneralRe: Read Only Transactions Pin
Rein Hillmann1-May-03 19:42
Rein Hillmann1-May-03 19:42 
GeneralRe: Read Only Transactions Pin
Patje4-May-03 20:43
Patje4-May-03 20:43 
GeneralSQL Statement Help... Pin
Jason Weibel28-Apr-03 9:51
Jason Weibel28-Apr-03 9:51 
GeneralRe: SQL Statement Help... Pin
Timur Fanshteyn28-Apr-03 11:07
Timur Fanshteyn28-Apr-03 11:07 
GeneralRe: SQL Statement Help... Pin
Jason Weibel28-Apr-03 11:43
Jason Weibel28-Apr-03 11:43 
QuestionADO events biased to COM memory model? Pin
Chopper28-Apr-03 9:33
Chopper28-Apr-03 9:33 
GeneralRelated Tables: How to set forgeign key of child table when adding new rows to parenttable Pin
STW27-Apr-03 10:41
STW27-Apr-03 10:41 
GeneralRe: Related Tables: How to set forgeign key of child table when adding new rows to parenttable Pin
perlmunger30-Apr-03 5:05
perlmunger30-Apr-03 5:05 
GeneralRe: Related Tables: How to set forgeign key of child table when adding new rows to parenttable Pin
STW30-Apr-03 5:25
STW30-Apr-03 5:25 
GeneralToolbar and Short Keys/Cuts Pin
STW27-Apr-03 6:30
STW27-Apr-03 6:30 
GeneralQuery Help Pin
NickOne26-Apr-03 12:35
NickOne26-Apr-03 12:35 
QuestionHow to get the last inserted and updated id (primary_key) with Sql C# Pin
STW26-Apr-03 3:24
STW26-Apr-03 3:24 
AnswerRe: How to get the last inserted and updated id (primary_key) with Sql C# Pin
David Salter26-Apr-03 10:29
David Salter26-Apr-03 10:29 
GeneralRe: How to get the last inserted and updated id (primary_key) with Sql C# Pin
STW26-Apr-03 23:02
STW26-Apr-03 23:02 
GeneralRe: How to get the last inserted and updated id (primary_key) with Sql C# Pin
David Salter30-Apr-03 11:37
David Salter30-Apr-03 11:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.