4

I've been researching this problem for days and have decided to ask this question here to see if anyone can help point me in the right direction.

I'm trying to populate combo boxes in my Netbeans 8.0.2 program with data from an MS Access 2013 table.

I'm using the most recent "Ucanaccess" with all of its necessary components to get the connection between the two, and from what I can tell the connection is good. However, when I run the program, it pops up an error exception message, reading:

net.ucanaccess.jdbc.UcanaccessSQLException: feature not supported

And that's it - no other letters, characters, numbers... nothing.

I'm honestly lost. Does anyone have any idea why I might be receiving this exception message?

Also, I'm running this on a Mac, however I use parallels and am actually running it on Microsoft Windows 7 virtual platform. It hasn't given me any trouble at all since then. 64 bit.

Here's what I've got coded.

import java.sql.*;
import javax.swing.*;

public class NewJFrame extends javax.swing.JFrame {
    Connection conn = null;
    ResultSet rs = null;
    PreparedStatement pst = null;

    private void FillCombo() {
        String sql = "Select [Description] from [Doors]";
        try {
            String driver = "net.ucanaccess.jdbc.UcanaccessDriver";
            Class.forName(driver);
            conn = DriverManager.getConnection("jdbc:ucanaccess://C:/Test/DB.accdb");
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery(sql);

            while (rs.next()) {
                String nme = rs.getString("Description");
                cmb1.addItem(nme);
            }
            conn.close();
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null,e);
        }            
    }

    /**
     * Creates new form NewJFrame
     */
    public NewJFrame() {
        initComponents();
        FillCombo();            
    }

Updated:

net.ucanaccess.jdbc.UcanaccessSQLException: feature not supported
    at net.ucanaccess.jdbc.UcanaccessStatement.executeQuery(UcanaccessStatement.java:202)
    at NewJFrame.FillCombo(NewJFrame.java:26)
    at NewJFrame.<init>(NewJFrame.java:50)
    at NewJFrame$2.run(NewJFrame.java:117)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.sql.SQLFeatureNotSupportedException: feature not supported
    at org.hsqldb.jdbc.JDBCUtil.notSupported(Unknown Source)
    at org.hsqldb.jdbc.JDBCPreparedStatement.executeQuery(Unknown Source)
    at net.ucanaccess.jdbc.UcanaccessStatement.executeQuery(UcanaccessStatement.java:199)
    ... 17 more
6
  • In you catch block try putting e.printStackTrace(); This will tell you more about where the error occurs. Are you running the code in Parallels (under Windows) or running it under Mac? Commented Jul 14, 2015 at 3:06
  • I'm running the code in Parallels under a Mac ( I use a MacBook Pro ) on the Windows side, if that makes sense. I added the code. Now the message is this.. (see updated original post) Commented Jul 14, 2015 at 3:27
  • 1
    You need use pst.executeQuery() instead of pst.executeQuery(sql) Commented Jul 14, 2015 at 3:39
  • I just did the biggest face palm in the history of the world. Thank you @MadProgrammer. I appreciate your responses and assistance! Commented Jul 14, 2015 at 3:51
  • 1
    @MadProgrammer - Please consider posting your solution as an answer. Commented Jul 14, 2015 at 4:52

1 Answer 1

8

You need to call PreparedStatement#executeQuery() not PreparedStatement#executeQuery(String)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.