Call vs Execute Procedure and JDBC
Posted in 2000
Topics: Stored Procedures & SPL, Connectivity: ODBC / JDBC / .NET, Connectivity: ESQL/C, 4GL & Embedded SQL, Java & JDBC Development
From Java, I have two ways of executing a stored procedure in the engine: Connection con = DriverManager.getConnection(engineURL, loginProperties); PreparedSatement ps = con.prepareStatement("execute procedure X()"); ResultSet rs = ps.executeQuery(); or Connection con = DriverManager.getConnection(engineURL, loginProperties); CallableSatement cs = con.prepareCall("{call X()}"); ResultSet rs = cs.executeQuery(); The first uses a prepared statement approach, while the other does a "call". In terms of the amount of work the engine has/needs to do is there any difference? This mimics, I take it, the 4GL usage so, perhaps, if there were a difference in 4GL there would be a difference in Java, too? I would appreciate any enlightenment. Cheers-- Charles
Hi The two ways of calling the procedure are similar and should be no difference in the way the server treats them. Elham In article <01bffd46$3e4f84c0$2f0a020a@pc0333>, charles.johnson@news.accessllc.net wrote: > From Java, I have two ways of executing a stored procedure in the engine: > > Connection con = DriverManager.getConnection(engineURL, loginProperties); > PreparedSatement ps = con.prepareStatement("execute procedure X()"); > ResultSet rs = ps.executeQuery(); > > or > > Connection con = DriverManager.getConnection(engineURL, loginProperties); > CallableSatement cs = con.prepareCall("{call X()}"); > ResultSet rs = cs.executeQuery(); > > The first uses a prepared statement approach, while the other does a > "call". > > In terms of the amount of work the engine has/needs to do is there any > difference? This mimics, I take it, the 4GL usage so, perhaps, if there > were a difference in 4GL there would be a difference in Java, too? I would > appreciate any enlightenment. > > Cheers-- > Charles > > Sent via Deja.com http://www.deja.com/ Before you buy.