how to key in and retrieve data?

now i got this code..can pls teach me how to key in the data n retrieve data from the databasE?wat code should i need to use..got any reference?how can i edit the data too?and how i retrieve the data from database( Access) and display in my table?can guide me pls?thounsand of thank you.

now i can link the database already..i know to create column but dunno how to create row..and dunno how to insert the data to the column that i created..and do not know how to display the data on my table that i created by usign java....

import java.sql.*;

public class Test

{

public static void main(String[] args)

{

try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

/* the next 3 lines are Step 2 method 2 from above - you could use the direct

access method (Step 2 method 1) istead if you wanted */

String dataSourceName = "mdbTEST";

String dbURL = "jdbc:odbc:" + dataSourceName;

Connection con = DriverManager.getConnection(dbURL, "","");

// try and create a java.sql.Statement so we can run queries

Statement s = con.createStatement();

s.execute("create table TEST ( column_name integer )"); // create a table

s.execute("insert into another values(1)"); // insert some data into the table

s.execute("select column_name from another"); // select the data from the table

ResultSet rs = s.getResultSet(); // get any ResultSet that came from our query

if (rs != null) // if rs == null, then there is no ResultSet to view

while ( rs.next() ) // this will step through our data row-by-row

{

/* the next line will get the first column in our current row's ResultSet

as a String ( getString( columnNumber) ) and output it to the screen */

System.out.println("Data from column_name: " + rs.getString(1) );

}

//s.execute("drop table TEST12345");

s.close(); // close the Statement to let the database know we're done with it

con.close(); // close the Connection to let the database know we're done with it

}

catch (Exception err) {

System.out.println("ERROR: " + err);

}

}

}

[2183 byte] By [ahgana] at [2007-10-2 3:29:44]
# 1
Weren't the links in your previous post helpful enough?I don't think anyone would post a complete tutorial for that.
RichardTheLionHearteda at 2007-7-15 22:39:28 > top of Java-index,Java Essentials,Java Programming...
# 2

i know how to insert the data already..

but

abcdefg( in Microsoft Access)

h

i

j

k

l

now i can create the column of a b c d e f g..but how to create the h i j k l?

and how i retrieve the data and let the data disply on my table that i create?

ahgana at 2007-7-15 22:39:28 > top of Java-index,Java Essentials,Java Programming...
# 3
juz ignore this post..doubt solved...thanks everyone n richard
ahgana at 2007-7-15 22:39:28 > top of Java-index,Java Essentials,Java Programming...
# 4
> juz ignore this post..doubt solved...thanks everyone> n richardGoodtohearthat! (-:
RichardTheLionHearteda at 2007-7-15 22:39:28 > top of Java-index,Java Essentials,Java Programming...