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: NetBeans and SQLite error

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default NetBeans and SQLite error

    Hi everybody

    I've spent a good portion of an hour trying to figure out my mistake.

    I am continuously getting a "no such table error".

    I have two classes. The one offers the connection, which works fine.

    The other signs in. I have used a tutorial from YouTube and followed it in detail...

    This is where the error comes up. Specifically, the bold part.

    ----

    private void entryButtonActionPerformed(java.awt.event.ActionEv ent evt) {
    String sql = "select * from CoachInfo where Username=? and Password=?";
    try {
    pst = conn.prepareStatement(sql);
    pst.setString(1, usernameField.getText());
    pst.setString(2, passwordField.getText());

    rs = pst.executeQuery();

    if (rs.next()) {
    JOptionPane.showMessageDialog(null, "Username and Password are correct.");

    CoachOptions s = new CoachOptions();
    s.setVisible(true);
    } else {
    JOptionPane.showMessageDialog(null, "Username and/or Password incorrect.");
    }

    } catch (SQLException ex) {
    Logger.getLogger(SignIn.class.getName()).log(Level .SEVERE, null, ex);
    }
    }



    The error is:

    Oct 13, 2012 8:55:21 PM SignIn entryButtonActionPerformed
    SEVERE: null
    java.sql.SQLException: no such table: CoachInfo
    at org.sqlite.DB.throwex(DB.java:288)
    at org.sqlite.NativeDB.prepare(Native Method)
    at org.sqlite.DB.prepare(DB.java:114)
    at org.sqlite.PrepStmt.<init>(PrepStmt.java:37)
    at org.sqlite.Conn.prepareStatement(Conn.java:231)
    at org.sqlite.Conn.prepareStatement(Conn.java:224)
    at org.sqlite.Conn.prepareStatement(Conn.java:213)
    at SignIn.entryButtonActionPerformed(SignIn.java:181)
    at SignIn.access$300(SignIn.java:17)
    at SignIn$4.actionPerformed(SignIn.java:98)
    at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:2028)
    at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2351)
    at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.jav a:6382)
    at javax.swing.JComponent.processMouseEvent(JComponen t.java:3275)
    at java.awt.Component.processEvent(Component.java:614 7)
    at java.awt.Container.processEvent(Container.java:208 3)
    at java.awt.Component.dispatchEventImpl(Component.jav a:4744)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2141)
    at java.awt.Component.dispatchEvent(Component.java:45 72)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4619)
    at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:4280)
    at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:4210)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2127)
    at java.awt.Window.dispatchEventImpl(Window.java:2489 )
    at java.awt.Component.dispatchEvent(Component.java:45 72)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:704)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:663)
    at java.awt.EventQueue$2.run(EventQueue.java:661)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectio nPrivilege(AccessControlContext.java:87)
    at java.security.AccessControlContext$1.doIntersectio nPrivilege(AccessControlContext.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:677)
    at java.awt.EventQueue$3.run(EventQueue.java:675)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectio nPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 674)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:122)

    -----


    Any help would be greatly appreciated...

    Ari
    Last edited by Boquito17; October 13th, 2012 at 02:14 PM.


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

    Default Re: NetBeans and SQLite error

    Thread moved from What's wrong with my code.

    The Exception message is pretty clear...you don't have a table named CoachInfo in the database the program is connected to. Make sure you have selected the appropriate database (and if relevant schema), and that this database contains the appropriate tables.

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: NetBeans and SQLite error

    Quote Originally Posted by copeg View Post
    Thread moved from What's wrong with my code.

    The Exception message is pretty clear...you don't have a table named CoachInfo in the database the program is connected to. Make sure you have selected the appropriate database (and if relevant schema), and that this database contains the appropriate tables.
    Hi. Sorry about placing my thread in the wrong location.

    This is precisely my issue. I open the database and the table is indeed there... And I've tried with the other tables in the database and still I reach the same conclusion...

  4. #4
    Junior Member
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: NetBeans and SQLite error

    Got it fixed. Thank everybody. My location was formatted as Windows, and I'm working on a Mac ("/" instead of "\\"). Thanks!

Similar Threads

  1. Help with sqlite please
    By mikesummer78 in forum JDBC & Databases
    Replies: 1
    Last Post: July 5th, 2012, 08:26 PM
  2. Netbeans GUI help
    By kprofgold in forum AWT / Java Swing
    Replies: 1
    Last Post: February 26th, 2012, 08:02 AM
  3. New to NetBeans
    By _lithium_ in forum Java IDEs
    Replies: 0
    Last Post: March 1st, 2011, 08:48 PM
  4. SQLite and Desktop Application
    By urosz in forum JDBC & Databases
    Replies: 12
    Last Post: November 2nd, 2009, 03:50 AM
  5. Netbeans help
    By [Kyle] in forum Java IDEs
    Replies: 2
    Last Post: September 20th, 2009, 06:32 PM