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...

hello jake... kumusta kna? hehe

//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..

thanks, alpe gulay!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.