Fedora Linux Support Community & Resources Center
  #1  
Old 18th August 2010, 01:49 PM
Jamwa Offline
Registered User
 
Join Date: Jan 2008
Location: Nairobi Kenya
Posts: 540
linuxfedorafirefox
Accessing JDBC SQLite MetaData

Having followed the example given at http://www.zentus.com/sqlitejdbc/ I was able to run it successfully. A little modification however:

Code:
while (rs.next())
{
    System.out.println("name = " + rs.getString("name"));
    System.out.println("job = " + rs.getString("occupation"));
}
System.out.println(rs.getMetaData().getColumnCount()); // <- MODIFIED
rs.close();
conn.close();
Throws this Exception:

Code:
Exception in thread "main" java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state
        at org.sqlite.RS.checkCol(RS.java:62)
        at org.sqlite.RS.getColumnCount(RS.java:319)
        at workshop.Test.main(Test.java:53)
Java Result: 1
I have Googled around but no fix I find. Any help please?
Reply With Quote
  #2  
Old 18th August 2010, 03:10 PM
RupertPupkin's Avatar
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 4,719
linuxfedorafirefox
Re: Accessing JDBC SQLite MetaData

Put that new println statement right before the while loop. Putting it after the loop causes an error because at that point there are no more records to point to in the ResultSet rs.

Last edited by RupertPupkin; 19th August 2010 at 12:16 AM. Reason: clarified which println statement I was talking about
Reply With Quote
  #3  
Old 19th August 2010, 07:17 AM
Jamwa Offline
Registered User
 
Join Date: Jan 2008
Location: Nairobi Kenya
Posts: 540
linuxfedorafirefox
Re: Accessing JDBC SQLite MetaData

Sweet! Worked like a charm :-)
Reply With Quote
Reply

Tags
accessing, jdbc, metadata, sqlite

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 11 weird problem accessing accessing port 80 egstern Servers & Networking 0 1st March 2010 03:48 AM
Jdbc problem kate_2008 Using Fedora 1 11th May 2009 05:58 PM
Jdbc ibbo Programming & Packaging 2 26th March 2009 02:55 PM
Oracle jdbc cdlaforc Programming & Packaging 3 23rd May 2007 04:13 PM


Current GMT-time: 21:57 (Tuesday, 18-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat