Recent Pos

Working with java.sql.Date type using JDBC

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail

jdbc date data type
⇒ Working with the Date type field is always convenient with the PreparedStatement.

⇒ The java.sql.Date class is introduced in JDBC in support of working with database Date data type with Java.

⇒ The Date class provides conversions between the Oracle Date data type and Java java.sql.Date, java.sql.Time, java.sql.Timestamp types.

⇒ The java.sql.Date is a subtype of java.util.Date.

⇒ The setDate(int index, Date value) method of PreparedStatement is used to set the date type value.

⇒ The java.sql.Date class is a non-abstract class in JDBC API. This supports the following constructor for creating the object:

 
Example:

-This will create a Date object representing the current (today) date.
 
Example:

⇒ We want to insert a record into the following table in Oracle:

 

 
 
<-Previous: The JDBC PreparedStatement Object | | Next->The JDBC CallableStatement Object

No Comments

Post a Comment