1

I am using spring-xd-1.0.0.M6.

I try to configure mysql DB as a sink for the Spring-xd

I follow -http://theblasfrompas.blogspot.in/2014/01/springxd-filetail-input-ingestion-jdbc.html

I put my jdbc.properties file - in the

1) spring-xd-1.0.0.M6/xd/modules/sink/jdbc/config location

2) I put mysql connector jar in the

spring-xd-1.0.0.M6/xd/lib

I create a file - input.txt and put it in the folder - /<some path>/temp/input.txt

The file contains

{"id":"1","name":"pas"}
{"id":"2","name":"lucia"}
{"id":"3","name":"lucas"}
{"id":"4","name":"siena"}

jdbc file contains following informations.

driverClass=com.mysql.jdbc.Driver
url=jdbc:mysql://127.0.0.1:3306/spring_xd
username=root
password=root

Now in the XD shell I execute following

stream create --name filetest --definition "tail --name='/<some path>/temp/input.txt' |  jdbc --columns='id,name'" --deploy

My my-sql DB table name is - file_test and it has 2 columns id and name - same as mentioned in the Example Link

But I get

Command failed org.springframework.xd.rest.client.impl.SpringXDException: Error with option(s) for module jdbc of type sink:
    columns: option named 'columns' is not supported

If I specify the tableName param, also I get ..

tableName: option named 'tableName' is not supported

I also refer - https://github.com/spring-projects/spring-xd/pull/621

But clue less .... with latest Spring-xd build

user3575226
  • 111
  • 5
  • 15
  • I'd suggest using XD 1.0.0.M4, just like that blog post. These are milestone versions and things change pretty quickly from one release to the other. – Andrei Stefan May 23 '14 at 20:58

1 Answers1

0

The directory you put your .properties file is not meant to configure the module, but declare which options are available. By putting it there, you've basically declared that the jdbc module has no options (as you're in fact not using the correct syntax).

Instead, you need to put the .properties file you mention elsewhere. Note that the exact location being picked up has changed between releases. I suggest using the latest release (M7 at the time of writing). Then, the correct location is

${xd.home}/config/modules/sink/jdbc/jdbc.properties

and not

${xd.home}/modules/sink/jdbc/config/jdbc.properties   

Note that the XD release currently does provide such a file out of the box, whose contents looks like:

url = ${spring.datasource.url}
driverClassName = ${spring.datasource.driverClassName}
username = ${spring.datasource.username}
password = ${spring.datasource.password}

This is to have the jdbc module use the values defined in server.yml by default

ebottard
  • 1,997
  • 2
  • 12
  • 14