Results 1 to 3 of 3
  1. #1
    pardhu is offline Member
    Join Date
    Oct 2011
    Posts
    16
    Rep Power
    0

    Default Retrieval problem

    Dear frnds,
    I have created a table and inserted rows into it using insert query.
    When I am trying to retrieve them using them I'm not getting them.

    MY PROGRAM



    import java.sql.*;
    class imp
    {
    public static void main(String args[])throws Exception
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:pardhu" ,"scott","tiger");
    System.out.println("connection established");
    Statement st=con.createStatement();
    ResultSet rs=st.executeQuery("select * from mca");
    while(rs.next())
    {
    System.out.println(rs.getString(1));
    System.out.println(rs.getString(2));
    System.out.println(rs.getString(3));
    System.out.println(rs.getString(4));
    }
    }
    }

    If I am using a java program to insert rows into the table, I am able to retrieve them.
    But If I am inserting the rows using insert query, I am not able to retrieve the rows.

    Can anyone help me plz......

  2. #2
    Mithilesh is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Thumbs up Re: Retrieval problem

    Create DSN as you mentioned in your program and then you must do commit after inserting some rows in database .After that you try to run this program hopefully it will work.
    Last edited by Mithilesh; 11-11-2012 at 02:20 PM.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Retrieval problem

    Please use [code] tags [/code] when posting code.

    What database are you using?
    Is the above code throwing an exception? If so, what is the full exception including stack trace.
    If not then are you seeing any data at all?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Image retrieval
    By KiranA in forum New To Java
    Replies: 1
    Last Post: 07-11-2011, 07:29 PM
  2. URL retrieval using swings
    By gbose in forum AWT / Swing
    Replies: 1
    Last Post: 02-07-2010, 02:19 PM
  3. web image retrieval
    By ak88 in forum New To Java
    Replies: 3
    Last Post: 01-05-2010, 11:37 AM
  4. retrieval of tags
    By mahalakshmi in forum New To Java
    Replies: 1
    Last Post: 02-23-2009, 12:58 PM
  5. Lucene Image REtrieval 0.5.4
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-11-2007, 03:54 PM

Posting Permissions

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