The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
master
Posted by: john | August 24, 2009 @ 7:39pm
Java Code
[
Download
]
int ret_val = -1; Statement count_stmt = null; ResultSet count_rs = null; Connection conn = getConnection(); try { count_stmt = conn.createStatement(); count_rs = count_stmt.executeQuery(sql); count_rs.next(); ret_val = count_rs.getInt(1); } catch (SQLException se) { System.out.println("SQLException: " + se.getMessage()); System.out.println("SQLState: " + se.getSQLState()); System.out.println("VendorError: " + se.getErrorCode()); } finally { // it is a good idea to release // resources in a finally{} block // in reverse-order of their creation // if they are no-longer needed if (count_rs != null) { try { count_rs.close(); } catch (SQLException sqlEx) { } // ignore count_rs = null; } if (count_stmt != null) { try { count_stmt.close(); } catch (SQLException sqlEx) { } // ignore count_stmt = null; } if (conn != null) { try { conn.close(); } catch (SQLException sqlEx) { } // ignore conn = null; } } return ret_val; }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.24 / 8
45 Votes
http://codebin.yi.org/350
page generated in 0.01 seconds