• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help

 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
Java Mac Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you tell specifically, what are the errors you receive ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic