spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dvlpr <nandolaprasi...@gmail.com>
Subject Custom receiver to connect MySQL database
Date Tue, 14 Jun 2016 07:29:09 GMT
Hi folks,
I have written some codes for custom receiver to get data from MySQL db.
Belowed code:

class CustomReceiver(url: String, username: String, password: String)
extends Receiver[String](StorageLevel.MEMORY_AND_DISK_2) with Logging {

 case class customer(c_sk: Int, c_add_sk: Int, c_first: String)
 
  def onStart() {
    // Start the thread that receives data over a connection
    new Thread("MySQL Receiver") {
      override def run() { receive() }
    }.start()
  }

  def onStop() {
   // There is nothing much to do as the thread calling receive()
   // is designed to stop by itself isStopped() returns false
  }

  private def receive() {
    Class.forName("com.mysql.jdbc.Driver").newInstance()
    val con = DriverManager.getConnection(url, username, password)
    }

while executing this code i am getting an error: Exception in thread "main"
java.lang.IllegalArgumentException: requirement failed: No output operations
registered, so nothing to execute

Please help me to solve my problem ? 



--
View this message in context: http://apache-spark-developers-list.1001551.n3.nabble.com/Custom-receiver-to-connect-MySQL-database-tp17895.html
Sent from the Apache Spark Developers List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org


Mime
View raw message