Hi, I’m using Spark-Sql to insert the data in the csv in a table in Sql Server as database. The createJDBCTable command is working fine with it. But when i’m trying to insert more records in the same table that I have created in database using insertIntoJDBC, it is throwing an error message –
Exception in thread “main” com.microsoft.sqlserver.jdbc.SQLServerException: There is already an object named ‘TestTable1’ in the database. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:314) at org.apache.spark.sql.DataFrameWriter.jdbc(DataFrameWriter.scala:252) at org.apache.spark.sql.DataFrame.insertIntoJDBC(DataFrame.scala:1495) at com.dataframe.load.db.DataFrameToObjectDBCommand.saveInDB(DataFrameToObjectDBCommand.java:156) at com.dataframe.load.db.DataFrameToObjectDBCommand.main(DataFrameToObjectDBCommand.java:162) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:665) at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:170) at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:193) at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:112) at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala) 15/09/11 12:47:23 INFO spark.SparkContext: Invoking stop() from shutdown hook 15/09/11 12:47:23 INFO storage.BlockManagerInfo: Removed broadcast_2_piece0 on 10.184.57.103:54266 in memory (size: 19.5 KB, free: 265.4 MB) 15/09/11 12:47:23 INFO storage.BlockManagerInfo: Removed broadcast_1_piece0 on 10.184.57.103:54266 in memory (size: 1821.0 B, free: 265.4 MB). I have tried insertIntoJDBC using by passing passing last argument as true and false but it is throwing same exception. Another thing is i’m using Spark-Sql version 1.4.1 and both the methods, createJDBCTable and insertIntoJDBC are deprecated. Can u pls help in doing the same. or if there is any other way to do the same in 1.4.1 version. -- View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Exception-in-Spark-sql-insertIntoJDBC-command-tp24655.html Sent from the Apache Spark User List mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@spark.apache.org For additional commands, e-mail: user-h...@spark.apache.org