Sie sind auf Seite 1von 3

Type-3 Driver

Net Protocol Pure Java Driver


1. This type-3 driver uses network protocol for connecting a java program with middleware server.
2. This driver follows three –tier architecture, it means java application connected with middle ware
server and middle ware server connect with database.
3. This type-3 driver implemented 100% java programming language. So it is platform independent
and also database independent.
4. This type-3 driver implemented 100% java programming language so it is platform independent.
5. It connect with a middle-ware server but not database directly. So it is platform independent of
databases.

Java Middleware
program Type-3 server Type-1 database
Type-2
Type-4

6. In case of type-3 driver the original database connectivity take care by middleware server.
7. Type 3 drivers shine when supporting Internet deployment in environments that connect to a
variety of DBMS servers requiring numerous concurrently connected users where performance
and scalability are major concerns. Therefore, to develop a high-performance, Internet-deployable
application, you'll often find it useful to convert your existing type 1 or 2 drivers to type 3 drivers.

Advantages
1. Type-3 driver is both platform independent and also database independent.
2. It is suitable for Real-time environment.
3. Heterogeneous database access.
A single IDS server can connect multiple heterogeneous database at the same time. Oracle,
Sybase, Informix, DB2, MYSQL, etc…

Drawbacks
1. Type-3 driver is server dependent.
2. A middleware server needs to be installing to work with type-3 driver.
3. Type-3 driver is slower than type-4 driver.
4. Type-3 driver uses a network protocol for connecting a java program with an application that is
running at server. After that the application running at server will take care remaining database
connectivity.
5. In case of IDS server JDBC driver connects java program and servlet application running in that
server after that servlet application takes care about connecting with database.
IDS Server
1. IDS server is open source middleware server provides type-3 JDBC driver called IDS driver.
2. Whenever we installed IDS server then it will be automatically started and it runs on port no. 13.
3. We can get IDS from www.idssoftware.com.
4. To verify whether IDS sever has started or not, we can open windows services from administrator
tools and we can find out in list of services IDB server started.
5. The following java program represents the type-3 driver, connecting with oracle database using
IDS server as middleware.

Callable Statement interface


1. CallableStatement is an interface given in java.sql package and it is extended in java.sql package
and it is extended from PreaparedStatement interface.
2. In callableStatement, there is one additional feature when compared with PreparedStatement.
3. The additional feature of CollableStatment is we can call both procedure and function of database.
4. CollableStatement is for both executing sql commands and also for calling procedure and
function.
Different ways of creating CallableStatement
1. CallableStatement is used for both executing sql commands on database and also calling
procedures and fuctions of the database.
2. In order to get CallableStatement reference(object), we need to call preapredCall() method given
by Connection interface.
3. We have two syntax for creating CallableStatement object, one for sql-command and other one is
for calling procedure and functions.
Syntax 1:-
CallableStatement cstmt=con.prepareCall(“sql command”);
Syntax 2:-
CallableStatement cstmt1=con.prepareCall(“{call pro_name(params)/fun_name(parms)}”);
4. In Programming languages, the difference between a procedure and function is, procedure does
not return any value but a function return a single value.
5. According to database programming, the difference between a procedure and function is,
procedure can return zero more values, but a function exactly returns only one value.

Syntax for creating a procedure

Create or replace procedure procedure_name(param if any)


is
variable declaration;
Begin
Stmt;
End;

6. Procedure are having three modes.


1) in 2)out 3) in out
7. In procedure in parameter is for accepting Input Values and out parameter is for producing the
output and in out parameter are both accepting input as well as producing Output.
8. By default a parameter is in mode.
9. By depending no. of out parameter, we can say that a procedure is returning these many out
values.
Note: while creating procedure don’t provide the size for an parameter.

IMP point for calling a procedure or function


1. While calling a procedure or function from java program then we need to call setXXX() method
and we need to pass values for in parameter.
2. If any out parameter are then we need to register the output parameter by calling
registerOutParameter();
3. To call a procedure or function the database, we need to used execute() method.
4. After executing the procedure or a function we need to call getXXX() method for reading out
parameters.

Working with in out parameter


If a procedure contains inout parameter then in a JDBC application we need the following two
steps.
1. Set input value for that parameter
2. Register the same parameter as out parameter by calling registerOutParameter.

Das könnte Ihnen auch gefallen