I'm trying to make Remote Procedure This is my code to create procedure.
Code:
CREATE PROCEDURE SIZE (OUT TAM INTEGER)
EXTERNAL NAME 'DIRECTE.SIZE'
LANGUAGE JAVA PARAMETER STYLE JAVA;
Java Class
Code:
public class DIRECTE {
public static void SIZE (int[]wrkcrsize){
Connection conexion;
int i=100;
try {
// Cargar el Controlador JDBC de DB2 de tipo 2 con DriverManager
Properties connectProperties = new Properties();
connectProperties.put("user", "remoteuser");
connectProperties.put("password", "remotepass");
connectProperties.put("databaseName","remotebd");
connectProperties.put("serverName","hostremote");
connectProperties.put("portNumber","50000");
Class.forName("com.ibm.db2.jcc.DB2Driver");
//Next line causes an error
conexion = DriverManager.getConnection("jdbc:default:connection",connectProperties);
conexion.setAutoCommit(false);
ResultSet Registros = null;
String sql1 = "SELECT COUNT(*) "
+ "FROM somsoc";
Statement SentenciaSQL = conexion.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
Registros = SentenciaSQL.executeQuery(sql1);
Registros.next();
wrkcrsize[0] = Registros.getInt(1);
SentenciaSQL.close();
conexion.commit();
conexion.close();
} catch (ClassNotFoundException e) {
System.out.println("Class not found");
System.out.println(e);
} catch (SQLException e) {
System.out.println(e.getErrorCode());
System.out.println(e);
}
}
if I use local data everything works perfect, when I test the java class and netbeans o cmd with >>java "classgenerate.class" that work in local and remote...