Hello,
I am trying to call from Java a stored procedure but I keep having exceptions!!!
In addition, I have no idea how I can get the result of the procedure !!!!
I have spent the whole day in Internet.... no luck!!
===============================================
I[b] java.lang.Exception: +updatejava.sql.SQLException: Unexpected token: # in statement [ call MODIFY_FIELD_SEPARATOR(#) ]
at util.UtilBean.test_upd(UtilBean.java:369)
===============================================
The following procedures have been created and tested withing the database and there work.
- public static String manage_field_separator(String ifs)
-public static String manage_refresh_interval(int val)
The alias have been created:
CREATE ALIAS MODIFY_FIELD_SEPARATOR FOR "com.lucent.util.StoredProcedures.manage_field_separator";
CREATE ALIAS MODIFY_REFRESH_INTERVAL FOR "com.lucent.util.StoredProcedures.manage_frefresh_interval
My
file.java contains the flollowing:
public String test_upd(String tableName, String paramValue)
throws Exception
{
String res="0";
Connection conn=null;
CallableStatement cs= null;
try
{
conn=DBConnection.DBConnect();
String p="MODIFY_"+tableName.toUpperCase()+"("+paramValue+")";
cs=conn.prepareCall( "{call "+p+"}");
cs.execute();
// Suppose to get the result res of the function!!!!
}
catch (SQLException e)
{
exceptionMessage="+update"+e.toString();
System.out.println("exceptionMessage="+exceptionMessage);
throw new Exception(exceptionMessage);
}
finally
{
Statement stmt=null;
DBConnection.closeConnection(conn,stmt);
}
return res;
}
Obviously I am doing something wrong ..... but I don't know what!!!
Could you help me please?
THanks a lot!