Kc
On Jul 30, 2014 3:55 PM, "srinivas" <[email protected]> wrote:
> Hi,
> I am trying to get data from mysql using JdbcRDD using code The table have
> three columns
>
> val url = "jdbc:mysql://localhost:3306/studentdata"
> val username = "root"
> val password = "root"
> val mysqlrdd = new org.apache.spark.rdd.JdbcRDD(sc,() => {
> Class.forName("com.mysql.jdbc.Driver")
> DriverManager.getConnection(url, username, password)
> },"SELECT * FROM student_info",
> 1, 20, 2, r => r.getString("studentname"))
> mysqlrdd.saveAsTextFile("/home/ubuntu/mysqljdbc")
>
> I am getting runtime error as
>
> 14/07/30 22:05:04 INFO JdbcRDD: statement fetch size set to: -2147483648
> to
> force MySQL streaming
> 14/07/30 22:05:04 INFO JdbcRDD: statement fetch size set to: -2147483648 to
> force MySQL streaming
> 14/07/30 22:05:04 INFO JdbcRDD: closed connection
> 14/07/30 22:05:04 INFO JdbcRDD: closed connection
> 14/07/30 22:05:04 ERROR Executor: Exception in task ID 0
> java.sql.SQLException: Parameter index out of range (1 > number of
> parameters, which is 0).
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084)
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973)
>
> Can anyone help. And let me know if i am missing anything.
>
> Thanks,
> -Srini.
>
>
>
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/Data-from-Mysql-using-JdbcRDD-tp10994.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>