aspose file tools*
The moose likes JDBC and the fly likes Java Database Connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java Database Connectivity" Watch "Java Database Connectivity" New topic
Author

Java Database Connectivity

kumar prabhakar
Greenhorn

Joined: Feb 27, 2012
Posts: 13
Dear friends,

I wanted to know that can we call procedures of oracle 10g from a Java code.
If yes, kindly provide the code.I also wanted to know how from a java code
we can connect to an oracle 10g database.Provide me an instance.
Eagerly waiting for your answers.
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 556

Welcome to coderanch..

Please note, javaranch is NotACodeMill..
Also, see ShowSomeEffort..

The things you are asking can be searched on the internet, and if you any doubts/questions after this, please post them here, people will be happy to help you, if you show effort in learning, we can't just give the code..
kumar prabhakar
Greenhorn

Joined: Feb 27, 2012
Posts: 13
Sorry! But i have already tried to find the answers on internet but could not get clear idea on calling of stored procedure from a java code.So, i thought to post the foolish question.
Carlo Moore
Greenhorn

Joined: Aug 02, 2005
Posts: 27
It's very similar to the way you'd called a user defined stored proc from a SQL Editor. I think you just have to add some extra curly brackets around the stored proc call.

Edit ORA FAQ has a lot of info
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

Check out java.sql.CallableStatement.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3611
    
  60

And since you're on Oracle, you could benefit from reading the Oracle Database JDBC Developer's Guide and Reference.

Just make sure not to use any Oracle specific JDBC extensions if you want your code to be "database agnostic", though in general the topic is more complicated than that.
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 556

kumar prabhakar wrote:Sorry! But i have already tried to find the answers on internet but could not get clear idea on calling of stored procedure from a java code.So, i thought to post the foolish question.


No need to ask sorry and all, you didn't do any mistake here..
Perhaps you could have told, what you searched and tried and what's not working..
However, for the question, as you have been already suggested, please check out java.sql.CallableStatement.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Database Connectivity