Ucanaccess SQL Exception: Feature Not Supported (Access and Netbeans)

I researched this issue for several days and decided to ask this question here to see if anyone can help me in the right direction.

I am trying to fill combo boxes in my Netbeans 8.0.2 program with data from MS Access 2013 table.

I am using the very latest "Ucanaccess" with all of its required components to get the connection between them and from what I can tell this is good. However, when I run the program, it gives an error message with the error:

net.ucanaccess.jdbc.UcanaccessSQLException: feature not supported

And that it is - no other letters, symbols, numbers ... nothing.

I'm honestly lost. Does anyone know why I can get this exception message?

Also, I run this on a Mac, however I use parallels and actually run it on a Microsoft Windows 7 virtual platform. Since then, I haven't had any problems. 64 bit.

Here is what I have 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

      

+3


source to share


1 answer


You need to call PreparedStatement#executeQuery()

notPreparedStatement#executeQuery(String)



+6


source







All Articles