Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8629293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:45:59+00:00 2026-06-12T08:45:59+00:00

I have a method written in java to execute the SQL statment for INSERT,UPDATE

  • 0

I have a method written in java to execute the SQL statment for INSERT,UPDATE and DELETE modes. This was working on WebSphere 6.1 and after upgrading to WebSphere 7.0 it stopped working.

Below is my code :

public void executeSQL() throws SQLException, ParseException, NamingException
{
    // Get a Connection from the Connection Pool if the connection is closed
    Connection dbCon = DriverUtilities.getConnectionFromContext(DriverUtilities.DIRECTPAY_DB);

    // create a Statment object whose ResultSet is  scroll sensitive and with Concurrent Updatable.
    Statement stmt = dbCon.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    dbCon.setAutoCommit(true);

    String strColumn = null;
    String colName = null;
    String colVal = null;
    String colType = null;

    String sql = null;

    try {
    if (isUpdate | isDelete) {
        //ResultSet rs = stmt.executeQuery("select * from " + getTableName());

        ResultSet rs = stmt.executeQuery("select * from " + getSqlFrom());

        //Move the ResultSet to the Row Index       
        rs.absolute(iRowIndex + 1);

        Enumeration enum1 = ColNames.elements();

        int i = 1;

        // Update Block
        if (isUpdate) {
            while (enum1.hasMoreElements()) {
                //column name for update
                strColumn = (String) enum1.nextElement();

                // value from the screen
                colVal = (String) requestParams.get("post" + strColumn);

                //get column type
                colType = colTypeHash.get(strColumn).toString();

                //if colvalue from screen not null then test for the Column type
                if ((colVal == null) || (colVal.equalsIgnoreCase("null"))){
                    rs.updateNull(i);                               
                } else {
                    if ((colType.equalsIgnoreCase("INT")) || (colType.equalsIgnoreCase("SMALLINT"))) {
                        if (colVal.trim().length() > 0)
                            rs.updateInt(i, Integer.parseInt(colVal));
                    } else if ((colType.equalsIgnoreCase("DATETIME"))) {
                        if (colVal.trim().length() > 0)
                            rs.updateTimestamp(i, toTimestamp(colVal));
                    } else if ((colType.equalsIgnoreCase("CHAR"))) {
                        //if (colVal.trim().length() > 0)
                            rs.updateString(i, colVal);
                    } else if ((colType.equalsIgnoreCase("NVARCHAR"))) {
                        //if (colVal.trim().length() > 0)
                            rs.updateString(i, colVal);
                    } else if ((colType.equalsIgnoreCase("VARCHAR"))) {
                        //if (colVal.trim().length() > 0)
                            rs.updateString(i, colVal);
                    } else if ((colType.equalsIgnoreCase("DECIMAL"))) {
                        if (colVal.trim().length() > 0)
                            rs.updateString(i, colVal);
                    } else if ((colType.equalsIgnoreCase("FLOAT"))) {
                        if (colVal.trim().length() > 0)
                            rs.updateDouble(i, Double.parseDouble(colVal));
                    } else if ((colType.equalsIgnoreCase("BIT"))) {
                        if (colVal.trim().length() > 0)
                            rs.updateByte(i, Byte.parseByte(colVal));
                        //rs.updateDouble(i, Double.parseDouble(colVal));
                    } else if ((colType.equalsIgnoreCase("int identity"))) {
                        // ignore it
                    } else {
                        System.out.println("WARNING DATATYPE UNSUPPORTED in ADMIN: " + colType);
                    }
                }

                i++;
            }
            //Setting Identity Insert ON.
            stmt.executeUpdate("SET IDENTITY_INSERT "+getTableName()+" ON");
            rs.updateRow();
        }

        //delete block
        if (isDelete) {
            rs.deleteRow();
        }

        rs.close();
    }

    //Insert Block
    if (isInsert) {
        //Setting Identity Insert ON.
        stmt.executeUpdate("SET IDENTITY_INSERT "+getTableName()+" ON");
        // get the SQL statement for Insert         
        sql = getSQL();

        int resultFlag = stmt.executeUpdate(sql);
    }
    //Setting Identity Insert OFF.
    stmt.executeUpdate("SET IDENTITY_INSERT "+getTableName()+" OFF");
    stmt.close();
    dbCon.close();

    } catch (SQLException e) {
        System.out.println("executeSQL failed: " + sql + ", " + StackTraces.getStackTrace(e));
        try {
            stmt.close();
        } catch(Exception ee){
        }
        try {
            dbCon.close();
        } catch(Exception ee){
        }
        throw (e);

    } catch (java.lang.NumberFormatException e) {
        System.out.println("executeSQL failed: " + sql + ", " + StackTraces.getStackTrace(e));
        try {
            stmt.close();
        } catch(Exception ee){
        }
        try {
            dbCon.close();
        } catch(Exception ee){
        }
        throw (e);
    }
}

Below is my Error stack trace :

[9/27/12 16:28:06:497 GMT-06:00] 0000002a SystemOut     O ---------------- sql = SELECT  * FROM PRODUCT ------------------------
[9/27/12 16:28:06:664 GMT-06:00] 0000002a SystemOut     O ERROR: 
[9/27/12 16:28:06:685 GMT-06:00] 0000002a WSRdbManagedC W   DSRA1300E: Feature is not implemented: javax.sql.PooledConnection.addStatementEventListener
[9/27/12 16:28:37:378 GMT-06:00] 0000002e SystemOut     O executeSQL failed: null, com.microsoft.sqlserver.jdbc.SQLServerException: Cannot find the object "PRODUCT" because it does not exist or you do not have permissions.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:775)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:676)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeUpdate(SQLServerStatement.java:633)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.pmiExecuteUpdate(WSJdbcStatement.java:1693)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeUpdate(WSJdbcStatement.java:1041)
    at com.bcbskc.bbb.directpay.admin.AdminTableBean.executeSQL(AdminTableBean.java:313)
    at com.bcbskc.bbb.directpay.admin.AdminTableBean.manipulateTable(AdminTableBean.java:132)
    at com.bcbskc.bbb.directpay.actions.ManipulateAdminTableAction.manipulateTable(ManipulateAdminTableAction.java:104)
    at com.bcbskc.bbb.directpay.actions.ManipulateAdminTableAction.execute(ManipulateAdminTableAction.java:46)
    at com.bcbskc.bbb.common.uiframework.Controller.doPost(Controller.java:56)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
    at com.bcbskc.bbb.common.security.AuthbeanFilter.doFilter(AuthbeanFilter.java:88)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)

[9/27/12 16:28:37:379 GMT-06:00] 0000002e SystemOut     O ManipulateAdminTableAction failed: There was an error updating the admin table.  Please check the data for errors and format. com.microsoft.sqlserver.jdbc.SQLServerException: Cannot find the object "PRODUCT" because it does not exist or you do not have permissions.com.microsoft.sqlserver.jdbc.SQLServerException: Cannot find the object "PRODUCT" because it does not exist or you do not have permissions.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:775)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:676)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeUpdate(SQLServerStatement.java:633)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.pmiExecuteUpdate(WSJdbcStatement.java:1693)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeUpdate(WSJdbcStatement.java:1041)
    at com.bcbskc.bbb.directpay.admin.AdminTableBean.executeSQL(AdminTableBean.java:313)
    at com.bcbskc.bbb.directpay.admin.AdminTableBean.manipulateTable(AdminTableBean.java:132)
    at com.bcbskc.bbb.directpay.actions.ManipulateAdminTableAction.manipulateTable(ManipulateAdminTableAction.java:104)
    at com.bcbskc.bbb.directpay.actions.ManipulateAdminTableAction.execute(ManipulateAdminTableAction.java:46)
    at com.bcbskc.bbb.common.uiframework.Controller.doPost(Controller.java:56)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
    at com.bcbskc.bbb.common.security.AuthbeanFilter.doFilter(AuthbeanFilter.java:88)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:46:00+00:00Added an answer on June 12, 2026 at 8:46 am

    The issue is solved with the help of answere from Jon Skeet to my other post. Follow this https://stackoverflow.com/a/12733027/1615051

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have written a method in java like this public boolean ADD(String ID,String Name,String
I have a simple recursive method written in both Java and C# Java public
I have a method written in VB.NET. It looks like this: Shared Sub SomeMethod(ByVal
I have a method somewhat similar to the one written bellow(this is just a
I have the following method for my android program, written in Java. The method
This sample program is meant to call a native method written in C. Java
Programming Language of choice is Java. I have written a method in java, to
I have an iOS method written to upload a chosen image to a web
I have a method called Get and a call back method called X written
I have written a method to calculate a given percentile for a set of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.