This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Kalyana Chakravathy

Greenhorn
+ Follow
since Nov 04, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kalyana Chakravathy

Thank you very much, it works now. By the way if I convert it into a function will there be any problem. I read that stored procedure is compiled only once and stored, where as a function is compiled every time. Is that true, if so how much does it affect the performance. I am very new to JDBC, hibernate, Stored Procedures and stuff. All I know is just some basic knowledge of SQL queries. Please correct me if I am wrong.
The procedure.



The java code,



This fails with the DB exception,



If I say


then it fails saying,



and it should fail as there is no such function. But the number of arguments that the stored procedure expects and the function expects have changed.

Thats why I got the doubt may be stored procedure doesn't return any value.
Hi,
I have a doubt on Oracle Stored Procedures and Functions. What is difference between the two and can a stored procedure return a value back. Some one at my place wrote a stored procedure that he says returns a cursor.
I wrote code in java using Stored Procedure in spring. But it always gives me a DB Exception.

It seems it thinks the procedure takes two parameters when I don't say its a function. I see in debug it takes the SqlOutParameter also as a stored procedure parameter. When I declare it to be a function its not, its seeing only SqlParameter declarations and changing.

It takes only one parameter.

If i change it to function in my java code, it says there is no function in scope, and there is none.

Thats when I got the doubt, can stored procedures return values.

Please answer anyone.

I had another thread with question on how to access stored procedure, but no one is answering it.

Thanks,
Kalyana CJ.
Hi Fatih,

I cannot make a stored procedure in DB1 to call the stored procedure in DB2, as the DB part is not owned and it has been decided this way. I cannot make a call on DB1 but only onDB2 via the DB link on DB1. Can you tell me if the below code will work correctly.



Thanks,
Kalyana
Hi,
I am pretty new to JDBC and hibernate, might be stupid so please don't get angry. I need to run a stored procedure on a DB via a DBLink because of direct access restrictions. I came to know about it only after I wrote some code with the expectation it will work. I use spring JDBC to call the stored procedure. Now I don't know how can change this to call the stored procedure on the DB link.



As you see there is nothing here that says run over this DBLink. How to specify it. I did some googling but got nothing, except one says PROC@remote_address(?, ?, ?)
but that involves manually opening a connection and making a call like
I don't want to change this code as spring takes care of much stuff. Help with the Stored Procedure to run over DBLink please.

Thanks,
Kalyana

Lee Kian Giap wrote:
Now, I bring out a good practice which one need to follow is , "In a constructor, you can call superclass method, because superclass surely is completely loaded and initialized. However, in a constructor, one should not (although you can) call method from its own class because it will give a non guarantee behavior where its own class haven't completely initialized"

All The Best, hope my explanation help you to progress.



Thanks, Now I understood how static declarations are instantiated in the first place. To just check if I understood correctly or not, I made the Test declaration in it non static and removed the getInstance() method and ran it. Now whatever may be the order it prints the values as static objects are instantiated first. Only in the previous case since both were static it followed the order of declaration. I made it like this,



One question, you said it better to always call the superclass from the constructor. By default the default superclass constructor is called. Also the object I want to refer or load when the object is instantiated is within that class and not the super class. So I guess it makes sense to call it from the constructor, or have that piece of code within the constructor itself. How does having superclass solve it. Do you say, I must put the static variable in the superclass ?
10 years ago
I am facing one weird problem when accessing a static object instance,

Test.java:



Run.java



On running Run it gives me a NPE,

[jkalyana@toddler ~]$ javac Test.java
[jkalyana@toddler ~]$ vim Run.java
[jkalyana@toddler ~]$ javac Run.java
[jkalyana@toddler ~]$ java Run
Exception in thread "main" java.lang.ExceptionInInitializerError
at Run.main(Run.java:3)
Caused by: java.lang.NullPointerException
at Test.enter(Test.java:10)
at Test.<init>(Test.java:7)
at Test.<clinit>(Test.java:4)
... 1 more


I had a doubt and changed the Test.java to this,



On moving the declaration of Test below map, it runs,

[jkalyana@toddler ~]$ java Run
Key = dummy1, Value = dummy2

Can anyone tell me why this is so.
10 years ago
Hi,
I am new to java and have written a small piece of code.

Test.java :





On running Run it gives me a NPE,

[jkalyana@toddler ~]$ javac Test.java
[jkalyana@toddler ~]$ vim Run.java
[jkalyana@toddler ~]$ javac Run.java
[jkalyana@toddler ~]$ java Run
Exception in thread "main" java.lang.ExceptionInInitializerError
at Run.main(Run.java:3)
Caused by: java.lang.NullPointerException
at Test.enter(Test.java:10)
at Test.<init>(Test.java:7)
at Test.<clinit>(Test.java:4)
... 1 more


I had a doubt and changed the Test.java to this,



On moving the declaration of Test below map, it runs,

[jkalyana@toddler ~]$ java Run
Key = dummy1, Value = dummy2

Can anyone tell me why this is so.
10 years ago