Hello i have a data base with a table called team
the table:
team (
FirstName varchar(30) not null,
LastName varchar(50) not null,
empnum integer CONSTRAINT employee not null PRIMARY KEY,
State varchar(50) not null,
Sport char(20)
) ;
i've made a sql trigger for that table, is suppossed that when some insert something in the table the trigger try to connect to other
database but when i insert something in the table i get the following
error
=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=-20142
[DataDirect][OpenEdge JDBC Driver][OpenEdge] Error en la Ejecución de Procedimientos Almacenados (Stored Procedure). (7853)
Correcto: Run tabla.llenar.sql. (8932)
Any help is welcome .
Thanks in advanced
The trigger:
CREATE TRIGGER EVENTO AFTER INSERT ON team
REFERENCING NEWROW
FOR EACH ROW
IMPORT
import java.sql.* ;
BEGIN
try
{
String c1,c2,c4,c5;
int num;
c1 = (String) NEWROW.getValue(1, CHAR);
c2 = (String) NEWROW.getValue(2, CHAR);
num = ((Integer)NEWROW.getValue(3,INTEGER)).intValue();
c4 = (String) NEWROW.getValue(4, CHAR);
c5 = (String) NEWROW.getValue(5, CHAR);
String driver = "org.postgresql.Driver";
//#jdbc
ostgreslq://ubicacion_de_BD
uerto/nombre_BD
String connectString = "jdbc
ostgresql://localhost:5432/";
String user = "postgresql"; //usuario
String password = "postgres";//clave
Class.forName(driver);
Connection conn = DriverManager.getConnection(connectString, user , password);
// Creamos una sentencia preparada donde despues
PreparedStatement crearRegistro = conn.prepareStatement(
"INSERT INTO " + "team" + "VALUES (?,?,?,?,?)");
// Establecemos los valores que estan con signo de '?' en la sentencia
crearRegistro.setString(1,c1);//FirstName
crearRegistro.setString(2,c2);//LastName
crearRegistro.setInt(3,num);//empnum
crearRegistro.setString(4,c4);//State
crearRegistro.setString(5,c5);//Sport
// Ejecutamos la sentencia
crearRegistro.executeUpdate();
// cerramos la sentencia, ¡importante!
crearRegistro.close();
// cerramos la conexion, ¡más importante!
conn.close();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
END
the table:
team (
FirstName varchar(30) not null,
LastName varchar(50) not null,
empnum integer CONSTRAINT employee not null PRIMARY KEY,
State varchar(50) not null,
Sport char(20)
) ;
i've made a sql trigger for that table, is suppossed that when some insert something in the table the trigger try to connect to other
database but when i insert something in the table i get the following
error
=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=-20142
[DataDirect][OpenEdge JDBC Driver][OpenEdge] Error en la Ejecución de Procedimientos Almacenados (Stored Procedure). (7853)
Correcto: Run tabla.llenar.sql. (8932)
Any help is welcome .
Thanks in advanced
The trigger:
CREATE TRIGGER EVENTO AFTER INSERT ON team
REFERENCING NEWROW
FOR EACH ROW
IMPORT
import java.sql.* ;
BEGIN
try
{
String c1,c2,c4,c5;
int num;
c1 = (String) NEWROW.getValue(1, CHAR);
c2 = (String) NEWROW.getValue(2, CHAR);
num = ((Integer)NEWROW.getValue(3,INTEGER)).intValue();
c4 = (String) NEWROW.getValue(4, CHAR);
c5 = (String) NEWROW.getValue(5, CHAR);
String driver = "org.postgresql.Driver";
//#jdbc


String connectString = "jdbc

String user = "postgresql"; //usuario
String password = "postgres";//clave
Class.forName(driver);
Connection conn = DriverManager.getConnection(connectString, user , password);
// Creamos una sentencia preparada donde despues
PreparedStatement crearRegistro = conn.prepareStatement(
"INSERT INTO " + "team" + "VALUES (?,?,?,?,?)");
// Establecemos los valores que estan con signo de '?' en la sentencia
crearRegistro.setString(1,c1);//FirstName
crearRegistro.setString(2,c2);//LastName
crearRegistro.setInt(3,num);//empnum
crearRegistro.setString(4,c4);//State
crearRegistro.setString(5,c5);//Sport
// Ejecutamos la sentencia
crearRegistro.executeUpdate();
// cerramos la sentencia, ¡importante!
crearRegistro.close();
// cerramos la conexion, ¡más importante!
conn.close();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
END