Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Updating SQLite database From java Bean + Ateam

Bharat8May 20 2016 — edited May 23 2016

Hi Experts,

     I am new to Oracle MAF 2.2, I am using Rest/JSON with AMPA. I want to Update a specific record IN SQLite database from Java Bean.

For that i started with Insert Statement from JAVA bean but its throwing error.

My code goes like below,

    public void testInsert(ActionEvent actionEvent) throws SQLException {

        // Add event code here...

        String docRoot = AdfmfJavaUtilities.getDirectoryPathRoot(AdfmfJavaUtilities.ApplicationDirectory);

        String dbName = docRoot + "/mb_cart_v9.db";

        Connection conn = new SQLite.JDBCDataSource("jdbc:sqlite:" + dbName).getConnection();

        conn.setAutoCommit(false);

      

        PreparedStatement stmt = conn.prepareStatement("insert into OM_ITEM_PRICE_LIST (PLI_ITEM_CODE, PLI_RATE) values (?,?);");

        throw new AdfException(dbName, AdfException.INFO);

        stmt.setString(1, "TEST");

        stmt.setString(2, "2000");

        stmt.executeUpdate();

        conn.commit();

    }

Please help.

Thanks & Regards,

Bharat

Comments
Post Details
Added on May 20 2016
8 comments
1,552 views