3. CREATE PROCEDURE dtp.TOTAL_LEAVE_FOR_TYPE (
EMPLOYEE CHAR(80),
LEAVE_TYPE_ID INT,
OUT TOTAL_LEAVE INT)
LANGUAGE JAVA
EXTERNAL NAME 'oracle.dtp.derby.sample.LeaveHelper.TotalLeaveForType '
PARAMETER STYLE JAVA;
Anthos
On 4/4/06, Anil Samuel <
[EMAIL PROTECTED]> wrote:
Hi
1. I created a Java class as below
package oracle.dtp.derby.sample;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement ;
import java.sql.ResultSet ;
import java.sql.SQLException;
public class LeaveHelper {
public static int TotalLeaveForType(String employee, int leaveTypeId)
{
int total = 0;
try {
Connection con = DriverManager.getConnection( "jdbc:default:connection");
PreparedStatement ps = con.prepareStatement("select TOTAL_TAKEN from DTP.LEAVE_APPROV where EMPLOYEE_ID=" + employee + " and LEAVE_TYPE_ID=" + leaveTypeId);
ResultSet rs = ps.executeQuery();
ps.close();
con.close();
total = rs.getInt(1);
}
catch (SQLException e)
{
e.printStackTrace ();
}
return total;
}
}
2. Compiled and created dtpLeaveApp.jar with this class.
3 . Added this jar to derby by
CALL SQLJ.install_jar(
'file:/tmp/dtpLeaveApp.jar',
'dtp.LeaveApp_jar',
0
);
4. Tried to execuet this procedure by doing
CALL dtp.TOTAL_LEAVE_FOR_TYPE('TOM',3);
but it results
ERROR 42Y03: 'SQLJ.INSTALL_JAR' is not recognized as a function or procedure.
How do I get this working ?
Regards
Anthos--
Anil Samuel < [EMAIL PROTECTED]>
Senior Technical Member
Product Development
Oracle Corporation
--
Anil Samuel <[EMAIL PROTECTED]>
Senior Technical Member
Product Development
Oracle Corporation
