954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to display the content of the database

Hello everyone!!!

I hope you could help me with this one...

In VB.NET ...If you want to display the content of your database in a datagridview component what you just need to do is to call odbc.odbcDataAdapter so that it will display all the data in datagrid as exactly as your database..


My question is, Does java has equivalent class for odbc.odbcDataAdapter like in VB.NET,

If yes , then may I know what class I need and if none, give me a piece of suggestions so that i can display in the content of my database in datagridview(If I am not mistaken JTable is the equivalent in java)

I am currently working in databases specifically odbc.

I hope you could help me with this one...

YOUR HELP IS HIGHLY APPRECIATED...

THANK YOU...

jk_bscomp
Light Poster
46 posts since Apr 2007
Reputation Points: 4
Solved Threads: 1
 

hello jake... kumusta kna? hehe

squinx22
Junior Poster in Training
68 posts since Mar 2007
Reputation Points: 7
Solved Threads: 2
 

//well im still a java beginners in java bro!just study out of this code maybe you will have the //idea on how to do...I've tried this code to get data in a cetain database..!
import java.sql.*;

public class alpe_connect_database
{
public static void main(String[] args)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ=c:\\data.mdb;");
Statement command = conn.createStatement();
ResultSet rs = command.executeQuery("select * FROM namelist");
while (rs.next())
{
System.out.print("ID NUMBER : ");
System.out.println(rs.getString(1));
System.out.println("NAME : "+rs.getString(3)+" , "+rs.getString(2));
System.out.println("");

}

System.out.println("Connected To Access");

}
catch (SQLException se)
{
System.out.println(se);
}
catch (Exception ex)
{
System.out.println(ex);
}
}
}

//just try it bro!gdluck..

alpe gulay
Light Poster
45 posts since May 2008
Reputation Points: 9
Solved Threads: 1
 

thanks, alpe gulay!!!

jk_bscomp
Light Poster
46 posts since Apr 2007
Reputation Points: 4
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You