This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes data feild storing in oracle database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic

data feild storing in oracle database

lokesh rajarathnam
Ranch Hand

Joined: May 17, 2007
Posts: 35
Hi all.,

I strucked in data storing to database, please push me out or this hurdel

import java.sql.*;

public class databaseconnecting

public databaseconnecting()
public String EFname=null;
public String EAddress=null;
public int Eage=0;

public dataconnect()
{ databaseconnecting dbc=new databaseconnecting();

Connection con=DriverManager.getConnection ("jdbcdbc:MYDSNname","scott","tiger");
Statement stmt=con.createStatement();
int count=stmt.executeUpdate("insert into tablename (name,age,address) values"+" ('"+dbc.getName()+"',"+dbc.getAge()+",'"+dbc.getAddress+"')");
System.out.println("count=" +count);
catch(Exception ex)
{ System.out.println("connection faild");

public String getName()
{ EFname="myname";
return EFname;
public int getAge()
return Eage;
public String getAddress()
return EAddress;

public Static void main(String args[])
databaseconnecting dbc=new databaseconnecting();
dbc.dataconnect() ;

Issue: The values are not inserted in to the database(oracle).
Rob Spoor

Joined: Oct 27, 2005
Posts: 19649

What does it print? count=1? Or connection failed?

How To Ask Questions How To Answer Questions
Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
Don't post same problem multiple times. That too in same forum!
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30050

Please continue discussion in your other thread. I'll close this one for you.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: data feild storing in oracle database
Similar Threads
SQL exception
missing expression error
Prepared Statement problem in my servlet's data manager
write a bytearray to an oracle db
write a bytearray to an oracle db