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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:18:09+00:00 2026-06-01T01:18:09+00:00

I am using following datatype in my database . but I got exception as

  • 0

I am using following datatype in my database .

but I got exception as Exception as:

in thread “Thread-2” java.lang.NumberFormatException: null

How to resolve it

btn.addActionListener(new ActionListener()
{
    Thread thread= new Thread()
    {
        public void run()
        { 
            Connection con= conn.getconnection();
            get_data();
            String Query = " INSERT INTO employees (Id,
                                P_F_No,
                                Name,
                                Date,
                                Guard/LP/ALP,
                                Incomming_Train,
                                Sign_off,
                                Room_Bed_No,
                                Out_going_train_time,
                                Sign_on,
                                subisezed_meal)
                                VALUES
                                (?,?,?,?,?,?,?,?,?,?,?)";

            try
            {
                PreparedStatement pr = con.prepareStatement(Query);
                pr.setString(1,data[0]);
                pr.setInt(2,Integer.parseInt(data[1]));
                pr.setString(3,data[2]);
                pr.setDate(4,Date.valueOf(data[3]));
                pr.setString(5,data[4]);
                pr.setTime(6,Time.valueOf(data[5]));
                pr.setTime(7,Time.valueOf(data[6]));
                pr.setString(8,data[7]);
                pr.setTime(9,Time.valueOf(data[8]));
                pr.setTime(10,Time.valueOf(data[9]));
                pr.setString(11,data[10]);
                pr.executeUpdate();
            }
            catch (SQLException ex)
            {
                System.out.println(ex);
            }
        }
    };

    thread.start();
});
  • 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-01T01:18:10+00:00Added an answer on June 1, 2026 at 1:18 am

    You should check if your variable is null and use ‘setNull’ method from PreparedStatement. For example:

    if (data[0] == null)
        pr.setNull(1, Types.INTEGER);
    else
         pr.setInt(1,data[0]);
    

    Something similar for other types(VARCHAR, etc.). Oracle is trying to convert the value you are passing to the type it is expecting. In your case, you have problems with numbers, but it could happen something similar with String if value is null. For that, you need to indicated that you want to insert a null value as I described above.

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

Sidebar

Related Questions

I am using following PHP code to connect to MS Access database: $odb_conn =
I am using following PHP code for trigger creation but always get error, please
I am using Derby database. I wrote this query: InputStream is = new java.io.ByteArrayInputStream(BYTES);
I am using Adventureworks2008R2 Database and trying to render the following. I have problem
So I am using the following functions to grab the datatype of certain fields
I am using the following code to pull in data from my database and
I am using following storedprocedure set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO Alter PROCEDURE
I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,
I'm using following peace of code to output an array: echo ======output without array_unique=====;
I am using following class to show a grid like appearance with pagination on

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.