Forums Register Login

Execute PL/SQL in Java -> NullPointerException

+Pie Number of slices to send: Send
Hi.
I tried executing some PL/SQL in Java and got a NullPointerException. Can anyone see where I went wrong (again ):
Here is the code:



+Pie Number of slices to send: Send
Change



to

+Pie Number of slices to send: Send
Two more points:

1) That isn't PL/SQL that you executed - that is plain ANSI SQL.
2) The convention is to start variable names with a lowercase, so you might want to change OraConnection to oraConnection.
+Pie Number of slices to send: Send
Final point:

The design of your program is wrong. You do not need to do any of that OraConnection=null and then checking that OraConnection isn't null business - if there is a problem setting OraConnection in your program, then the exception handling should take care of it. If there was no exception thrown, then you can assume that it is fine and proceed.
+Pie Number of slices to send: Send
 

Ahmed Bin S wrote:Two more points:

1) That isn't PL/SQL that you executed - that is plain ANSI SQL.
2) The convention is to start variable names with a lowercase, so you might want to change OraConnection to oraConnection.



Thanks, that worked well, I am falling for every thing in the book, trying to come back up to speed.

And yes, that's indeed plain ANSI SQL, but I do have reams of old PL/SQL and TSQL though

I don't think that's going to work on SQL Server though, I don't think the ojdbs understands Class.forname(), this is what I have to do next.

+Pie Number of slices to send: Send
Moving to our databases forum.
I do some of my very best work in water. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 926 times.
Similar Threads
Data source name not found and no default driver specified
Hi,I have a problem in database connection
JDBC and Pointbase
Result set type is TYPE_FORWARD_ONLY
how to resolve javax.naming.NoInitialContextException while using jndi to access datsource
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:35:40.