• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inserting date to oracle

 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got two questions.

1.Latest version of JDBC API?
2.I am working on a GUI based application that involves interaction with database. I had used PreparedStatement for executing queries. I want to sent the date which I am getting as an input from the user to the database. I used the following statement
stmt.setDate(4,txtyear.getText()); and I am getting compilation error. My database is Oracle and I had set that particular column which receives input from the above setString() method with Date datatype. Some one please help me.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. That's not a question. Do you mean "What is the latest version of the JDBC API?". Or "Where is the latest verson of the JDBC API?".
2. Re-read the JavaDocs for the PreparedStatement setDate methods. There isn't one which takes a String.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May i know what compilation error you are getting in.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vishnu,
1) JDBC 3.0 came out with Java 1.4. I don't recall the version number with Java 1.5. It does have some new JDBC features, so the version number has changed.
2) setDate() takes a Date object as the second parameter. getText() returns a String. You can use the SimpleDateFormat class to turn that String into a Date.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic