Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

entering data in oracle database

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 3895
542
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic