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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:05:57+00:00 2026-05-30T19:05:57+00:00

I am displaying date in JSF using pattern=dd-MMM-yyyy . When I am trying to

  • 0

I am displaying date in JSF using pattern="dd-MMM-yyyy".

When I am trying to insert/update date values into my oracle DB, I am getting

java.sql.SQLException: Invalid column type

because my date format before insert or update is in this format

Wed Feb 09 00:00:00 AST 2011

How can I correctly insert or update my date values to Oracle Db and what is the best approach for doing this?

Update 1

My db insert code.

private void editSchedule(Schedule schedule)
        Object[] values = { schedule.getStartDate(),
                schedule.getVacationId() };             
        Connection connection = null;       
        PreparedStatement preparedStatement = null; 
        try {                           
            connection = datacon.getConnection();               
            preparedStatement = prepareStatement(connection, SQL_EDIT, values);         
            preparedStatement.executeUpdate();          

        } catch (Exception e) {
            logger.info("errro "+e.getMessage());
            e.printStackTrace();
        } finally {
            // TODO: handle exception
            close(connection, preparedStatement);
        }

    }

PreparedStaement code part

public static PreparedStatement prepareStatement
        (Connection connection, String sql, Object... values)
            throws SQLException
    {
        PreparedStatement preparedStatement = connection.prepareStatement(sql
            );
        setValues(preparedStatement, values);
        return preparedStatement;
    }

    public static void setValues(PreparedStatement preparedStatement, Object... values)
        throws SQLException
    {
        for (int i = 0; i < values.length; i++) {
            preparedStatement.setObject(i + 1, values[i]);
            logger.info("sql  "+Arrays.asList(values));
        }
    }
  • 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-30T19:05:59+00:00Added an answer on May 30, 2026 at 7:05 pm

    It sounds like you’re trying to include the data as text when you’re inserting/updating. Don’t do that – use a java.sql.Date in a PreparedStatement. Introducing unnecessary string conversions is a really bad idea – it makes your code very brittle, and makes the code more confusijng: keep your data in an appropriate data type as long as you possibly can.

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

Sidebar

Related Questions

Why doesn't Chrome specify AM or PM when displaying a date by using date.toLocaleString()
I'm having trouble displaying the only date part of a DateTime into a textbox
I am displaying calendar using calendar control. Each date is displayed as Link button.
I'm using a javascript date selector within a HTML form, and it's displaying as
I am currently displaying date/time on my webpage using the date function PHP provides.
I am having trouble displaying Date s in the format I want in my
i have a combobox which is displaying date from database...in my database the date
Displaying Type here to ... until the user enters text into a TextBox is
When displaying my DateTime values, I want them to be formatted like so: February
I'm displaying a set of images as an overlay using Google Maps. Displaying these

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.