Created
April 14, 2020 16:19
-
-
Save saswata-dutta/e032dc3632f2ac9524f386776d163c0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Statement stmt = conn.createStatement( | |
ResultSet.TYPE_SCROLL_INSENSITIVE, | |
ResultSet.CONCUR_UPDATABLE); | |
String sql = "SELECT id, name, age FROM students"; | |
ResultSet rs = stmt.executeQuery(sql); | |
// update data in Result Set | |
rs.moveToInsertRow(); | |
rs.updateInt("id",5); | |
rs.updateString("name","John"); | |
rs.updateInt("age",21); | |
// insert row into database | |
rs.insertRow(); | |
/////////////////// | |
// no return procedure | |
{call procedureName(?,?,...)} | |
// procedure returns result | |
{? = call procedureName(?,?,...)} | |
CallableStatement cstmt = null; | |
try { | |
String SQL = "{call getExampleName (?, ?)}"; | |
cstmt = conn.prepareCall (SQL); | |
//. . . | |
} | |
catch (SQLException e) { | |
//. . . | |
} | |
finally { | |
cstmt.close(); | |
} | |
///////////////// | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment