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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:24:11+00:00 2026-05-31T20:24:11+00:00

I am trying to execute dynamic SQL in a Servlet using JDBC, I need

  • 0

I am trying to execute dynamic SQL in a Servlet using JDBC, I need to check either the user request was executed correctly or not.

I am ussing the Execute command wich return a boolean: TRUE indicates the result is a ResultSet and FALSE indicates it has the int value which denotes number of rows affected by the query.
And this method throws SQLException – if a database access error occurs.

So I don’t see any mean to tell the user either his request was executed correcty or not (because of a bad syntax)

  • 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-31T20:24:12+00:00Added an answer on May 31, 2026 at 8:24 pm

    If there was a database error, you will get an SQLException.

    If there is no database error, but the results are still “wrong” for your application, you have to add some extra checks in your own code (such as inspecting the number of affected rows, or running some additional queries). Maybe more constraints are also an option.

    Once you have determined if there was a problem, you can inform your user about it. You will have to break it down to him in terms that he can understand (because he has no idea about how your database works), how it affects him, and what he can do about it (such as retrying it later, double-checking his input data, or contacting user support). There is nothing JDBC can do to help you with that.

    If there was a problem, you probably also want to log the incident for future reference.

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

Sidebar

Related Questions

I'm trying to get this dynamic SQL running ( using EXECUTE IMMEDIATE ) M_SQL_STATEMENT
I am trying to create some dynamic sql using the following code block firstSqlStatement
I am trying to execute this SQL query prior to restoring a .BAK file
I am trying to execute this SQL command: SELECT page.page_namespace, pagelinks.pl_namespace, COUNT(*) FROM page,
I'm trying to execute a asp.net webservice using jquery. When I pass only one
I'm trying to execute the following line: exit | sqlplus username/password@sid @test.sql Works great
I'm trying to execute this: $ mysql --user=XXX --password=XXX --batch --skip-column-names \ -e SELECT
I'm trying to execute a SQL command, but I just can't find out why
I'm using C# with TSQL and SQL Server 2005 I'm trying to use PetaPoco
I'm trying to figure out if this is possible to execute on a dynamic

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.