Home » RDBMS Server » Server Administration » stored procedures and triggers
stored procedures and triggers [message #54705] Fri, 29 November 2002 08:13 Go to next message
rena
Messages: 8
Registered: November 2002
Junior Member
Hello,

I want to have trigger in an Oracle database that when an insertion is made in a table the same insertion is made to an table in an MS Access database in the same machine.

I have loaded my .class file to the oracle jvm.

My .java file is:

import java.sql.*;
import java.io.*;

public class POManager {

public static void addCustomer (int cid, String cfname, String clname, String city, float discnt) throws SQLException {
String sql = "INSERT INTO CUSTOMER VALUES (?, ?, ?, ?, ?)";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
} catch (Exception e) {
}

try {

String url = "jdbc:odbc:mydb";

// Connection.
Connection con = DriverManager.getConnection (URL,"","");
PreparedStatement pstmt = con.prepareStatement(sql);
pstmt.setInt(1, cid);
pstmt.setString(2, cfname);
pstmt.setString(3, clname);
pstmt.setString(4, city);
pstmt.setFloat(5, discnt);
pstmt.executeUpdate();
pstmt.close();

}catch(Exception ex){
System.out.println(ex.getMessage());
return;
}//end catch

}//end method
}//end class

I have created a procedure and a trigger which fires after insert.

No error is occured when executing the loadjava command.

But I when i execute the insertion command to the the oracle table through sqlplus, the insertion is made only to the oracle table.

I don't have any errors but it does'n work.

Can anybody help me find what is wrong.

Please answer as soon as possible beacuse i need it.

Thanks
Korina
Re: stored procedures and triggers [message #54707 is a reply to message #54705] Fri, 29 November 2002 08:47 Go to previous message
rena
Messages: 8
Registered: November 2002
Junior Member
I addition, when i execute:

set serveroutput on size 1000000;
exec dbms_java.set_output(1000000);

and the the insertion command i get:

insertion succesfull.......i.e for the oracle table
No suitable driver

Is there any driver that i have to download and load to the jvm using the loadjava command?

And where i can found it?

Thanks
Previous Topic: listener name??
Next Topic: Database Recovery question.
Goto Forum:
  


Current Time: Fri Sep 20 02:28:44 CDT 2024