This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Stoared procedure & Type 4 driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Stoared procedure & Type 4 driver" Watch "Stoared procedure & Type 4 driver" New topic

Stoared procedure & Type 4 driver

kedar parundekar
Ranch Hand

Joined: May 10, 2006
Posts: 40
import java.sql.*;
class DemoCallable {
public static void main(String a[])
Class.forName("oracle.jdbc.driver.OracleDriver");// Type 4 Driver
Connection conn = DriverManager.getConnection("jdbcracle:thin:@dbs:1521rcl","scott","tiger");

/*Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // to load Type1 driver
Connection conn=DriverManager.getConnection("jdbcdbc:mydsn","scott","tiger"); // for connection, mydsn is dsn , java is username, java is password*/

System.out.println("Connection : " + conn);
CallableStatement cstmt = conn.prepareCall(" {call sqr(?, ?)} ");
System.out.println("Callable Statement : " + cstmt);



boolean b=cstmt.execute();


catch(Exception e)

Q )In above code,
If I am using Type 1 driver ,Then its properly working(Return me square of 10)
But when I am using Type4 driver , It will show me Null Pointer Exception.
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1082

What does e.printStackTrace() say ?


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
I agree. Here's the link:
subject: Stoared procedure & Type 4 driver
It's not a secret anymore!