wood burning stoves*
The moose likes JDBC and the fly likes help 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
Bookmark "help" Watch "help" New topic
Author

help

numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
Hi

I am new to java. I am trying to call data from Oracle using java code but got few errors. Can you please help me where I am going wrong.

Thanks in advance.

Code:

sri ramvaithiyanathan
Ranch Hand

Joined: Nov 20, 2010
Posts: 109
numan ahmad wrote:



Welcome to coderanch.
I just looked your code like a bird sight and pointing out the mistake you done.
1)Dont use if condition for resultset.use while loop.
2)Check the open and close braces.
3)use open and close brace for else part also
4)close the connection in finally.It's the good way of code practise.
5)Many more to say.Review your code before posting it.

And one more thing as Bear said place your codes inside code tag.
Please edit as soon as possible.
And kindly let us know where you faced problem and what you want to do.


For java examples,ebooks,interview questions,visit this blog
http://periodicupdates.blogspot.com/
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37890
    
  22
Bear Bibeault wrote:Welcome to the Ranch.

Please be sure to use code tags . . .
Since he is new, I'll add code tags and we can see how much easier the code is to read. Unfortunately it also makes the incorrect indentation easier to see. And the inappropriate style, using lower-case throughout for class names. If you are having problems matching pairs of {}, you can see the problems much sooner if you get the indentation right.

. . . And the design problems
class product extends customer


You should only extend from a class if you can really say, "A subclass IS A superclass." And there is no way I could say "a product is a customer", nor "an order is a product".
I think you would need to sort out the design of your classes before you can think about using a database.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37890
    
  22
I earlier wrote: . . . get the indentation right. . . .
Many people write code like this:etc., etc.

But I don't. I have had to learn I am writing code, not a letter. In a letter or something else on a word-processor, you start from the beginning and keep going to the end. But for code, try starting at both ends and work back towards the middleetc., etc.

Like that, you can always see that you have pairs of {}, and they are aligned vertically. It makes it much easier if you use a decent text editor: on *nix use gedit, Kate, etc, and on Windows try Notepad2, Notepad++ jEdit, etc. They can be set to support bracket matching, automatic indentation, automatic conversion of tabs to spaces, etc. Makes programming much easier.
Neo Smith
Greenhorn

Joined: Feb 01, 2011
Posts: 5

can you tell specifically, what are the errors you receive ?


-- Free your mind ---
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: help
 
Similar Threads
how to display database values in a table
can not find symbol symbol: construtor product()
Access to the Oracle database using Java Applets
Can someone look at program
how to run code in netbeans