Results 1 to 3 of 3

Thread: [RESOLVED] JDBC ODBC with MS Access

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Resolved [RESOLVED] JDBC ODBC with MS Access

    Hello,

    I have a problem. I am trying to access and display the data available in the MS Access. Please check the code and rectify.

    [JAVACODE]
    import java.sql.*;

    public class Test
    {
    public static void main(String ags[])
    {
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection("jdbcdbc:test","","");
    Statement st = conn.createStatement();
    ResultSet rs = st.executeQuery("select * from test");
    while(rs.next())
    {
    int id = rs.getInt(1);
    String name = rs.getString(2);
    System.out.println(id + " " + name);
    System.out.println("<br/>");
    }
    }
    catch(Exception e)
    {
    System.out.println("Error");
    }
    }
    }
    [/JAVACODE]

    Thanks & Regards.

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Smile Re: JDBC ODBC with MS Access

    Thanks ComputerJy. I have solve the problem already.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width