Current location: Hot Scripts Forums » General Web Coding » JavaScript » having problem in retrieving data n displaying data from database


having problem in retrieving data n displaying data from database

Reply
  #1 (permalink)  
Old 11-22-04, 11:47 PM
mathfxr mathfxr is offline
Newbie Coder
 
Join Date: Nov 2004
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
having problem in retrieving data n displaying data from database

i just wondering somebody could give me suggestion or correct my mistake in this programming because i cannot displaying information from database.
this is my prog but it did not complete yet.i hope somebody could tell me how to retrieve , store data in variable from database and diplaying in text area

ublic class nazrie extends JFrame {

static {
try {
// step 1 load driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//DriverManager.registerDriver (new sun.jdbc.odbc.JdbcOdbcDriver());


} catch (ClassNotFoundException ex) {
System.out.println(ex.getMessage());
System.exit(0);
}

}

public static void main(String args[]) {
String r1=null, r2=null,r3=null,r4=null,r5=null,r6=null,r7=null,r8 =null, r9=null,r10=null,r11=null,r12=null;
String ar[] = new String[500];
int n=1;
int count=0;
dat1 re1= new dat1();
dat1 re2= new dat1();
dat1 re3= new dat1();
dat1 re4= new dat1();
dat1 re5= new dat1();
dat1 re6= new dat1();
JTextArea textArea = new JTextArea();
JFrame frame = new JFrame();



try {

// step 2 : create connection

Connection con = DriverManager.getConnection("jdbcdbc:ODBC_HIST") ;

// step 3 : For queries create a statement to execute SELECT statements
Statement st = con.createStatement();

// step 4 : execute a SELECT query and obtain a ResultSet
String Query = "Select dtmast.dt_name,dtmast.dt_addr1,dtmast.dt_addr2,dtm ast.dt_addr3,dtmast.dt_addr4,dtmast.dt_code,invhis t.inv_num,invhist.inv_date,vesmast.ves_name,invhis t.scn,vestype.ves_type_descr,vestype.ves_type_desc r,vesmast.loa,vesvoyhist.act_date_arv,terminal.ter m_name,vesmast.grt,vesvoyhist.act_time_arv"+
" FROM invhist, invitemhist, dtmast,vesvoyhist,vesmast,terminal,vestype "+
" where invhist.inv_num = 'VI0000000101'AND invhist.inv_num=invitemhist.inv_num AND invhist.dt_code=dtmast.dt_code AND invhist.scn=vesvoyhist.scn AND vesvoyhist.ves_code= vesmast.ves_code AND vesvoyhist.term_code=terminal.term_code AND vesmast.ves_type=vestype.ves_type ";
String Query1 = "Select dtmast.dt_name,dtmast.dt_addr1,dtmast.dt_addr2,dtm ast.dt_addr3,dtmast.dt_addr4,dtmast.dt_code,invhis t.inv_num,invhist.inv_date,vesmast.ves_name,invhis t.scn,vestype.ves_type_descr,vestype.ves_type_desc r,vesmast.loa,vesvoyhist.act_date_arv,terminal.ter m_name,vesmast.grt,vesvoyhist.act_time_arv,invitem hist.inv_descr1,invitemhist.inv_descr2,invitemhist .inv_descr3,vesvoyhist.term_code,invitemhist.inv_r ate"+
" FROM invhist, invitemhist, dtmast,vesvoyhist,vesmast,terminal,vestype "+
" where invhist.inv_num = 'VI0000000101'AND invhist.inv_num=invitemhist.inv_num AND invhist.dt_code=dtmast.dt_code AND invhist.scn=vesvoyhist.scn AND vesvoyhist.ves_code= vesmast.ves_code AND vesvoyhist.term_code=terminal.term_code AND vesmast.ves_type=vestype.ves_type ";




// String Query = "SELECT * FROM EMPLOYEES";

ResultSet record1=st.executeQuery(Query1);

// step 5 : loop through all records


while(record1.next())
{

n=1;



r1=record1.getString(1);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-23-04, 01:42 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
This doesn't look like JavaScript to me, more like Java.
Did you post in the wrong forum?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem getting data from DataGrid on update petersza ASP.NET 5 10-20-04 12:37 AM
I having a problem when updatting the data w_inaim ASP 1 09-21-04 03:12 PM
Script for uploading data from local database to production database pual_cruzs PHP 1 07-06-04 01:44 AM
i have a problem regarding updating database online GENIUSAdnan PHP 1 06-23-04 04:53 AM


All times are GMT -5. The time now is 11:01 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.