sam
sam

Reputation: 161

Got error with PUTSQL with insert statement in replace text processor in nifi,

Got error with PUTSQL with insert statement in replace text processor in nifi, and its showing following error in putSQL " routing to failure: com.microsoft.sqlserver.jdbc.SQLServerException: The index 4 is out of range."

Upvotes: 2

Views: 1238

Answers (2)

Pons
Pons

Reputation: 1111

@sam, regarding your issue with date fields, it could be related to https://issues.apache.org/jira/browse/NIFI-2625. I have faced similar kind of problem abd discussed the same here PutSql - date format error

Upvotes: 1

Mahendran V M
Mahendran V M

Reputation: 3496

@sam your insert query is perfect and

Following cases are may be reason for your issue.

i.)please ensure the SQL Connection have table "yahoo". And also ensure that your sql connection string have "database" name like below.

jdbc:microsoft:sqlserver://<host>:<port>;DatabaseName=DATABASE

ii.)If you give insert query like below,

insert into yahoo (ID, Name, Rate, Time, Ask, Bid, Date) values ('a', 'a', '1', 'a', '1', 'a', 'a')

Then you should have all columns in yahoo table in varchar or char or text type only.

iii.)If any one of columns in yahoo is "int" you have remove the single quotes like below.

For example in 3rd column of yahoo table "Rate" is an integer you have to change insert query like below.,

insert into yahoo (ID, Name, Rate, Time, Ask, Bid, Date) values ('a', 'a', 1, 'a', '1', 'a', 'a')

(removed single quotes in 3rd column Rate).

let me know above changes worked for you.

Upvotes: 1

Related Questions