• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

entering data in oracle database

 
arjun gaur
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey! i managed to connect to the Oracle databas for express edition
I created a table :
create table Out_Patient(Patient_ID number(8) primary key ,First_Name varchar2(20) , Last_Name varchar2(20) ,Gender varchar2(10) , Mobile_Number number(12) , Address varchar2(20), Date_Of_Birth Date , Date_Of_Entry Date)
Now i have a form to fill up all these details but,i'm getting an sqlexception: ORA-01861:literals does not match format string
Can you tell what's causing it.am i entering data in wrong format ? I guess it might be due to 2 dates Date_Of_Birth and Date_Of_Entry.
in my JDBC code i'm doing this
String t1=text_dob.getText(); String t2=text_doe.getText();
and then
st.setStrin(7,t1);
st.setString(8,t2);
Please let me know what i'm doing wrong.
Thanks..
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hard to say, since you haven't even shown us the statement which is giving you the exception.

Generally it looks like you're letting the database to do an implicit conversion. You should always avoid that, in this case I'd suggest converting the String representations to dates in Java and using PreparedStatement.setDate() to set the date in the database.
 
Ron McLeod
Bartender
Pie
Posts: 1027
64
Android Eclipse IDE Java Linux MySQL Database Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this related to your other post?

Like Martin said, post the code (with code tags) so we can see exactly what you are trying.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic