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 8225827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:32:48+00:00 2026-06-07T15:32:48+00:00

I am updating remote DB by JDBC Prepared statements. When I execute the same

  • 0

I am updating remote DB by JDBC Prepared statements.
When I execute the same code to update local DB it takes milliseconds but for remote DB it is taking too long for around 900 rows.
Size of all rows combined is 160 KB.
Remote Host is Hostgator and DB Engine for table is InnoDB.

Here is my code:

String insertTableSQL = "INSERT INTO abc(zzz,c,d,e,timestamp) VALUES (?,?,?,?,?)";

String delSt = "DELETE FROM abc WHERE zzz= ?";

del = connection.prepareStatement(delSt);
preparedStatement = connection.prepareStatement(insertTableSQL);
connection.setAutoCommit(false);
Iterator<DataObject> itr = updationList.iterator();
while (itr.hasNext()) {
    DataObject dO = itr.next();
    del.setString(1, dO.a + ":" + dO.b);
    for (SubObject sO : dO.getsO.values()) {
        try {
            preparedStatement.setString(1, sO.a + ":" + sO.b);
            preparedStatement.setString(2, sO.c);
            preparedStatement.setInt(3, sO.d);
            preparedStatement.setFloat(4, sO.e);
            preparedStatement.setTimestamp(5, getCurrentTimeStamp());
            preparedStatement.addBatch();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
try {
    del.execute();
    preparedStatement.executeBatch();
} catch (Exception e) {
    e.printStackTrace();
}
try {
    connection.commit();
}
...
  • 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-07T15:32:50+00:00Added an answer on June 7, 2026 at 3:32 pm

    You should check that the indexes are the same on your local table and on the remote server. The delete is likely the culprit and EXPLAIN SELECT * FROM abc WHERE zzz=? will show you what’s going on there. You can try adding compression to your connection by adding useCompression=true to your JDBC connection string. This will shrink that 160k down a bit and while it’s sending commands.

    http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html

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

Sidebar

Related Questions

Not sure how I've managed this but I can't create a local and remote
I have a remote form for updating one of my objects. However, after updating,
Updating an old piece of software but in order to maintain backward compatibility I
I want to fetch a branch from a remote, but my branch name does
I have two lists of entities. Imagine list1 is remote and list2 is local
Is it possible to connecting a remote mysql server and auto update another database
My Combobox is not alway updating when I update the ArrayCollection. [Bindable] public var
I have a Rails 3 app that uses a remote/AJAX link to update a
Im am trying to get MSDeploy to execute a PowerShell script on a remote
I have a form that should use remote => true when it's updating a

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.