Giter Site home page Giter Site logo

Comments (7)

theangryangel avatar theangryangel commented on June 2, 2024

Can you give me the config you're running, if possible please Alex?

from logstash-output-jdbc.

alexschultz avatar alexschultz commented on June 2, 2024

input {
couchdb_changes {
db => "couchDocumentDb"
host => "localhost"
username => "admin"
password => "password"
}
}

filter {
}

output {
if [doc][schema] == "special" {
jdbc {
idle_flush_time => 10
flush_size => 5
max_flush_exceptions => 5
username => "user"
password => "password"
connection_string => "jdbc:sqlserver://localhost:1433;databaseName=helloworld;"
statement => [ "INSERT INTO dbo.reports (ReportServer, ReportName, ReportPath, IsActive, CreatedBy, CreateDate, LastModifiedDate, IsAddParameter) VALUES(?, ?, ?, ?, ?, ?, ?, ?)",
"%{[doc][schema]}",
"%{[doc][schema]}",
"%{[doc][schema]}",
1,
"%{[doc][schema]}",
"%{[doc][schema]}",
"%{[doc][schema]}",
"%{[doc][schema]}",
1]
}
}
}

from logstash-output-jdbc.

theangryangel avatar theangryangel commented on June 2, 2024

Just to see what happens, can you add quotes around the 1's in the statement array? I'm going to guess that it works. If that's the case I think I have a quick patch to write 😅

Edit: So something like:

statement => [ "INSERT INTO dbo.reports (ReportServer, ReportName, ReportPath, IsActive, CreatedBy, CreateDate, LastModifiedDate, IsAddParameter) VALUES(?, ?, ?, ?, ?, ?, ?, ?)",
"%{[doc][schema]}",
"%{[doc][schema]}",
"%{[doc][schema]}",
"1",
"%{[doc][schema]}",
"%{[doc][schema]}",
"%{[doc][schema]}",
"%{[doc][schema]}",
"1"]

from logstash-output-jdbc.

alexschultz avatar alexschultz commented on June 2, 2024

Awesome, that fixed the initial issue! I have a couple of SQL syntax issues but I think those might be on my end.
Thanks for the super quick reply!

from logstash-output-jdbc.

theangryangel avatar theangryangel commented on June 2, 2024

Thanks for being responsive! (seriously ❤️)

Honestly, it really shouldn't be error'ing like that, so I definitely have a patch to write and some test cases to add 👍

The SQL statement does have a mismatched number of ?'s and columns, so there is that as well.

from logstash-output-jdbc.

theangryangel avatar theangryangel commented on June 2, 2024

I've backported this fix from the v5 branch to for v2 of logstash, and pushed 0.2.10 to rubygems 😄

You should find that this now works correctly, without throwing any errors

from logstash-output-jdbc.

alexschultz avatar alexschultz commented on June 2, 2024

It's working now, thanks for the super quick turnaround!

from logstash-output-jdbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.