Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: no data found ms -access sql exception

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default no data found ms -access sql exception

    class Testdb
    {
    public static void main(String ...arg)
    {
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection c =DriverManager.getConnection("jdbcdbc:jatindsn","system","pwd");
    System.out.println("Connection ok.");

    //String t1 = "raam";
    //int t2 = 10;
    Statement s = c.createStatement();
    ResultSet result1 = s.executeQuery("select * from Tsable1");
    while(result1.next())
    {
    System.out.println("name" + result1.getString(1));
    System.out.println("id" + result1.getString(2));
    System.out.println("roll num"+result1.getString(3));
    }

    }
    catch(SQLException e)
    {
    System.out.println(e);
    }
    catch(Exception i)
    {
    System.out.println(i);
    }

    }
    }


  2. #2
    Junior Member
    Join Date
    Feb 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: no data found ms -access sql exception

    its compiled successfully but when i run it it shows :
    java.sql.SQLException:no data found
    but i hav written code in try n catch block !!
    help plz

  3. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: no data found ms -access sql exception

    We need to know more, where is this error occurring specifically? To get the full detail of the error, put e.printStackTrace() instead of System.out.println(e) in your catch statements.

    The try and catch blocks will not prevent an error from occurring, but rather prevent your entire program from crashing in the event of an error.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: no data found ms -access sql exception

    Ditto what ausiemcgr said. In addition, rather than using System.out to print the exception, call printStackTrace on the exception - much more informative.

Similar Threads

  1. application id not found
    By pradeepsetty in forum Java IDEs
    Replies: 3
    Last Post: June 2nd, 2010, 02:37 AM
  2. problem with data access when a class call another class
    By ea09530 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 4th, 2010, 05:20 PM
  3. Pulling in data from access
    By tdc5013 in forum JDBC & Databases
    Replies: 2
    Last Post: March 15th, 2010, 04:40 PM
  4. Jsp source not found
    By jadeite100 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 15th, 2010, 01:00 AM
  5. Default Access (package access) confusion
    By gauravrajbehl in forum Java Theory & Questions
    Replies: 1
    Last Post: November 18th, 2009, 04:11 AM