During a software project we stumbled upon a bug, where we inserted a large number (17 digits) from Java into Oracle DB procedure. The number changed it's value sometimes +1 or -1. Sometimes stayed the same. We checked the oracle DB driver debug log and saw that it printed the correct number. We also tried restarting Java application server between each request, to eliminate wierd caching errors. Still got the same results.
Any ideas why this is happening?
Here's the code:
// Datasource configuration
<New class="oracle.jdbc.pool.OracleDataSource">
<Set name="DriverType">thin</Set>
<Set name="URL">jdbc:oracle:thin:@xxxx</Set>
<Set name="User">uuuu</Set>
<Set name="Password">pppp</Set>
</New>
// JAVA
SimpleJdbcCall testMsg = new SimpleJdbcCall(dataSource).
withSchemaName(schema).
withCatalogName(catalog).
withProcedureName("test_msg");
public void testMessage(Long n) {
testMsg.execute(n, n, n.toString());
}
// PL_SQL
procedure test_msg(
i integer,
n number,
v varchar2
) is
log_prfx log_pkg.t_log_prfx := 'test_msg: ';
begin
g_log.log_debug(log_prfx||'i='||to_char(i));
g_log.log_debug(log_prfx||'n='||to_char(n));
g_log.log_debug(log_prfx||'v='||v);
end test_msg;
Now calling
testMessage(10000000000000005L);
testMessage(10000000000000007L);
testMessage(10000000000000009L);
End up with logs like
test_msg: i=10000000000000005
test_msg: n=10000000000000005
test_msg: v=10000000000000005
test_msg: i=10000000000000008
test_msg: n=10000000000000008
test_msg: v=10000000000000007
test_msg: i=10000000000000008
test_msg: n=10000000000000008
test_msg: v=10000000000000009
Versions we are using.
- Spring 3.2.11
- Oracle driver ojdbc7_g-12.1.0.2 (we also tested with 11.2.0.4)
- Oracle DB is version 12.1.0.1.0
- Jetty 9.2.2 and JBoss 7 (the same behaviour appeared in both)