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

  • Home
  • SEARCH
  • 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 5848371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:50:58+00:00 2026-05-22T12:50:58+00:00

public void insertOrUpdate(String customerNumber, Long creditLimitAmount) throws SQLException { Connection connection2 = UBOCMSSQLConnectionUtill.getMSSqlConnection(); connection2.setAutoCommit(false);

  • 0

public void insertOrUpdate(String customerNumber, Long creditLimitAmount)
throws SQLException {

Connection connection2 = UBOCMSSQLConnectionUtill.getMSSqlConnection();
connection2.setAutoCommit(false);
PreparedStatement updatePreparedStatement = null;
PreparedStatement insertPreparedStatement = null;
try {
    String updateQuery = "UPDATE CRLM2 SET BR=?, LIMITTYPE =?, LIMITMEMBER=?,"
        + "PRODUCT=?,PRODTYPE=?,MTYDATE=?,CCY=?,CREQLIMAMT=?,MRKTLIMAMT=?,EXPDATE=?,"
        + "PRODGROUPID=?,AMT1=?,AMT2=?,DATE1=?,DATE2=?,TEXT1=?,TEXT2=?,LIMITSEQ=?,"
        + "STARTDATE=?,UPDATECOUNTER=? WHERE LIMITMEMBER = ?";

    String insertQuery = "insert into CRLM2(" + "BR," + "LIMITTYPE,"
        + "LIMITMEMBER," + "PRODUCT," + "PRODTYPE," + "MTYDATE,"
        + "CCY," + "CREQLIMAMT," + "MRKTLIMAMT," + "EXPDATE,"
        + "PRODGROUPID" + "AMT1," + "AMT2," + "DATE1," + "DATE2,"
        + "TEXT1," + "TEXT2," + "LIMITSEQ," + "STARTDATE,"
        + "UPDATECOUNTER) "
        + "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

    /**
     * First try to update the row, but if that row does not exists,
     * then insert it.
     */
    updatePreparedStatement = connection2.prepareStatement(updateQuery);
    updatePreparedStatement.setString(1, "01");
    updatePreparedStatement.setString(2, "C");
    updatePreparedStatement.setString(3, customerNumber);
    updatePreparedStatement.setString(4, "FXD");
    updatePreparedStatement.setString(5, "FX");
    updatePreparedStatement.setString(6, "tbd");
    updatePreparedStatement.setString(7, "USD");
    updatePreparedStatement.setLong(8, creditLimitAmount);
    updatePreparedStatement.setNull(9, java.sql.Types.NUMERIC);
    updatePreparedStatement.setNull(10, java.sql.Types.DATE);
    updatePreparedStatement.setNull(11, java.sql.Types.CHAR);
    updatePreparedStatement.setNull(12, java.sql.Types.NUMERIC);
    updatePreparedStatement.setNull(13, java.sql.Types.NUMERIC);
    updatePreparedStatement.setNull(14, java.sql.Types.DATE);
    updatePreparedStatement.setNull(15, java.sql.Types.DATE);
    updatePreparedStatement.setNull(16, java.sql.Types.CHAR);
    updatePreparedStatement.setNull(17, java.sql.Types.CHAR);
    updatePreparedStatement.setNull(18, java.sql.Types.NUMERIC);
    updatePreparedStatement.setNull(19, java.sql.Types.DATE);
    updatePreparedStatement.setNull(20, java.sql.Types.NUMERIC);
    int count = updatePreparedStatement.executeUpdate();
    System.out.println("count value after updatePreparedStatement is "
        + count);
    connection2.commit();
    connection2.close();
    updatePreparedStatement.close();      
    Connection connection3 = UBOCMSSQLConnectionUtill
        .getMSSqlConnection();
    insertPreparedStatement = connection3.prepareStatement(insertQuery);
    connection3.setAutoCommit(false);
    if (count == 0) {
    insertPreparedStatement.setString(1, "01");
    insertPreparedStatement.setString(2, "C");
    insertPreparedStatement.setString(3, customerNumber);
    insertPreparedStatement.setString(4, "FXD");
    insertPreparedStatement.setString(5, "FX");
    insertPreparedStatement.setString(6, "tbd");
    insertPreparedStatement.setString(7, "USD");
    insertPreparedStatement.setLong(8, creditLimitAmount);
    insertPreparedStatement.setNull(9, java.sql.Types.NUMERIC);
    insertPreparedStatement.setNull(10, java.sql.Types.DATE);
    insertPreparedStatement.setNull(11, java.sql.Types.CHAR);
    insertPreparedStatement.setNull(12, java.sql.Types.NUMERIC);
    insertPreparedStatement.setNull(13, java.sql.Types.NUMERIC);
    insertPreparedStatement.setNull(14, java.sql.Types.DATE);
    insertPreparedStatement.setNull(15, java.sql.Types.DATE);
    insertPreparedStatement.setNull(16, java.sql.Types.CHAR);
    insertPreparedStatement.setNull(17, java.sql.Types.CHAR);
    insertPreparedStatement.setNull(18, java.sql.Types.NUMERIC);
    insertPreparedStatement.setNull(19, java.sql.Types.DATE);
    insertPreparedStatement.setNull(20, java.sql.Types.NUMERIC);
    insertPreparedStatement.executeUpdate();
    connection3.commit();
    }
} finally {
    if (insertPreparedStatement != null) {
    insertPreparedStatement.close();
    }
}

}

}

found and returning db conn
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid parameter binding(s).
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.validateParameters(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.validateParameters(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.preImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at com.uboc.pdealcc.dao.PDealCCDao.insertOrUpdate(PDealCCDao.java:98)
at com.uboc.pdealcc.dao.PDealCCDao.getCustomerId(PDealCCDao.java:37)
at com.uboc.pdealcc.processor.COpxDeal.CheckQlim(COpxDeal.java:165)
at com.uboc.pdealcc.listeners.TablePopupListener.actionPerformed(TablePopupListener.java:130)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

  • 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-05-22T12:50:59+00:00Added an answer on May 22, 2026 at 12:50 pm

    There are 21 parameters in the update query but you are only setting values for 20 of them.


        UPDATE CRLM2 SET BR=1, LIMITTYPE =2, LIMITMEMBER=3,"
        + "PRODUCT=4,PRODTYPE=5,MTYDATE=6,CCY=7,CREQLIMAMT=8,MRKTLIMAMT=9,EXPDATE=10,"
        + "PRODGROUPID=11,AMT1=12,AMT2=13,DATE1=14,DATE2=15,TEXT1=16,TEXT2=17,LIMITSEQ=18,"
        + "STARTDATE=19,UPDATECOUNTER=20 WHERE LIMITMEMBER = 21
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public void DoPing(object state) { string host = state as string; m_lastPingResult = false;
public void MyTest() { bool eventFinished = false; myEventRaiser.OnEvent += delegate { doStuff(); eventFinished
public void EatDinner(string appetizer, string mainCourse, string dessert) { try { // Code }
public void valueChanged(TreeSelectionEvent event) { //Add images depending on selection. String selection = navigation.getLastSelectedPathComponent().toString();
public void onListItemClick(ListView parent, View v, int position, long id) { super.onListItemClick(parent, v, position,
public void AddNodeToXml(string helpid, string fileName) { const string STR_EXPRESSION = /Form/Controls/Control; XPathDocument doc
public void startElement(String uri, String localName, String qName, Attributes attributes) can anybody please give
public void correctLetter(String Letter, int pos){ if(letter.equals(a)){ ImageView image = images[pos]; image.setImageResource(R.drawable.a); image.setVisibility(ImageView.VISIBLE); }
public void Submit1_Click(Object sender, EventArgs E) { string strheadlinesid1 = string.Empty; if (!IsPostBack) {
public void Find() { String Value = ; System.out.println(Search Name); Value = Input.next(); int

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.