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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:31:32+00:00 2026-06-14T09:31:32+00:00

I have an if statement I have checked with breakpoints that my program is

  • 0

I have an if statement I have checked with breakpoints that my program is entering the if statement and it is. I can follow through my statement till I get to the prepare statement line then my if statement appears to break out for no reason and not executing any code under my prepare statement. I have searched for my issue and can’t get any solutions.

 if(entry != null && subNum.equals(1) && rs.getRow() == 1)
 {
         String blogID = rs.getString(1);
         String timeStamp = rs.getString(2);
         java.util.Date date= new java.util.Date();
         String tStamp = new Timestamp(date.getTime()).toString();
         query = "INSERT INTO blog_entries VALUES (?, ?, ?, ?, ?)";
         ps = con.prepareStatement(query);
         ps.setString(1, entry);
         out.print(entry);
         ps.setString(2, timeStamp);
         out.print(timeStamp);
         ps.setString(3, tStamp);
         out.print(tStamp);
         ps.setString(4, entry);
         out.print(entry);
         ps.setString(5, blogID);
         out.print(blogID);
         ps.executeUpdate();
         out.println("Submit Successful");
 }

The out.prints are there just for debugging purposes, any help would be appreciated.

  • 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-14T09:31:33+00:00Added an answer on June 14, 2026 at 9:31 am

    I guess con is not initiated if its breaking on the 1st use of it, can u confirm it is not null at the line its used? if yes catch and post the exception like:

     if(entry != null && subNum.equals(1) && rs.getRow() == 1)
     {
             String blogID = rs.getString(1);
             String timeStamp = rs.getString(2);
             java.util.Date date= new java.util.Date();
             String tStamp = new Timestamp(date.getTime()).toString();
             query = "INSERT INTO blog_entries VALUES (?, ?, ?, ?, ?)";
             try{
                    if (con != null)
                    {
                         ps = con.prepareStatement(query);
                         ps.setString(1, entry);
                         out.print(entry);
                         ps.setString(2, timeStamp);
                         out.print(timeStamp);
                         ps.setString(3, tStamp);
                         out.print(tStamp);
                         ps.setString(4, entry);
                         out.print(entry);
                         ps.setString(5, blogID);
                         out.print(blogID);
                         ps.executeUpdate();
                    } else { 
                         // print error and break }                    
                }
          catch (Exception e){
             //print error message
         }
             out.println("Submit Successful");
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a statement that throws a lot of checked exceptions. I can add
I have a switch case statement that doesn't work. I've checked the input, it's
Can an if statement have more than one then statements? # this works a
I have a statement that looks like this: <asp:CheckBox ID=CheckBoxProcess Checked='<%#Eval(processedField) %>' OnCheckedChanged=CheckBoxProcess_CheckedChanged runat=server
I have the following simple jquery get statement that calls a WebApi on my
I have a line of code that is working in one statement but not
I have this statement in my c program and I want to optimize. By
I have a statement similar to this that I need to run in Linq.
I have the following PHP PDO statement: $STH = $this->_db->prepare(INSERT INTO UserDetails (FirstName, LastName,
I have a program that simulates dice rolls and compares them to values in

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.