I have very strange issue. I design one function which is inserting values into postgresql table. But when I try to call that function from java at that time it seems like did not insert. Even I am not getting error as well. My code is below.
String query = "{call postgres.addToLog(?,?,?,?,?,?,?)}";
try{
CallableStatement ps = getPostgresConfiguratoin().prepareCall(query);
ps.setTimestamp(1, new Timestamp(new java.util.Date().getTime()));
ps.setInt(2, 705);
ps.setInt(3, 1);
ps.setInt(4, 1);
ps.setString(5, "192.168.2.101");
ps.setString(6, null);
ps.setString(7, query);
ps.executeUpdate();
ps.close();
}catch(Exception ex){
}
Is there anything wrong with my call?
I found in logs that my function insert query has one column name which has wrong spelling so my insert query never insert anything. After furthermore research I found out that as best practice to provide exception handling into PL-SQL as well. I provide Exception handler into my PL-SQL block and it return error which I can see on my Java program side as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.