0
SEVERE: null

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3109) at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337) at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:287)

 public Student_Registration() {
    super("");
    initComponents();

    try {
        //DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        con = DriverManager.getConnection("jdbc:odbc:student");
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "Check connectivity with database", "Error", 3);
    }


}

//Insert data to Db

 String insertinfo = "insert into student_info(name,dob,address,ten,twelve,sex,mail,mobile) values('" + txt_name.getText().toString() + "', '" + txt_dob.getText().toString() + "', '" + txt_add.getText().toString() + "', '" + txt_10.getText().toString() + "','" + txt_12.getText().toString() + "','" + cb_sex.getSelectedItem().toString() + "','" + txt_mail.getText().toString() + "','" + txt_mobile.getText().toString() + "')";


    try {
        Statement ist = con.createStatement();
        ist.executeUpdate(insertinfo);
    } catch (SQLException ex) {

        Logger.getLogger(Student_Registration.class.getName()).log(Level.SEVERE, null, ex);

        System.out.printf("" + insertinfo);
    }

1 Answer 1

1

Looks like this is just a file permission issue occuring with ODBC data sources.

MS says ;

This problem occurs if you try to edit a worksheet that is saved or opened as ReadOnly.

NOTE: ReadOnly is the default setting for an ODBC connection to Excel, with or without a data source name (DSN). Therefore, the user must always change that setting to edit data.

http://support.microsoft.com/kb/316475

You may check for read-only attribute in both db file and DSN settings.

To resolve this problem, use the following aproach:

  • Make sure that the LockType property of the Recordset object is not set to ReadOnly.
  • Make sure that the file that you are trying to open
  • If you are connecting through a DSN, follow these steps:

    • Open Control Panel, and then click ODBC Data Source Administrator.
    • Double-click your DSN.
    • In the ODBC Microsoft Excel Setup dialog box, click Options.
    • Make sure that the ReadOnly check box is not selected.
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.