Skip to content

Commit

Permalink
[SPARK-10946][SQL] JDBC - Use Statement.executeUpdate instead of Prep…
Browse files Browse the repository at this point in the history
…aredStatement.executeUpdate for DDLs

New changes with JDBCRDD

Author: somideshmukh <[email protected]>

Closes #9733 from somideshmukh/SomilBranch-1.1.

(cherry picked from commit b8f4379)
Signed-off-by: Sean Owen <[email protected]>
  • Loading branch information
somideshmukh authored and srowen committed Nov 18, 2015
1 parent 0eb8213 commit 5da7d41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ final class DataFrameWriter private[sql](df: DataFrame) {
if (!tableExists) {
val schema = JdbcUtils.schemaString(df, url)
val sql = s"CREATE TABLE $table ($schema)"
conn.prepareStatement(sql).executeUpdate()
conn.createStatement.executeUpdate(sql)
}
} finally {
conn.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ object JdbcUtils extends Logging {
* Drops a table from the JDBC database.
*/
def dropTable(conn: Connection, table: String): Unit = {
conn.prepareStatement(s"DROP TABLE $table").executeUpdate()
conn.createStatement.executeUpdate(s"DROP TABLE $table")
}

/**
Expand Down

0 comments on commit 5da7d41

Please sign in to comment.