Code Monkey home page Code Monkey logo

Comments (4)

burningalchemist avatar burningalchemist commented on June 24, 2024 1

Hi @shingou0120, I'm sorry for the late response - had many things around.

Generally, any database that has a driver in golang, supporting sql/database interface, and supported by dburl can be used by sql_exporter.

Following your case I found next things:

  • Oracle DB is supported. 👍 The suitable driver for Oracle DB is likely https://github.com/sijms/go-ora.

  • As for IBM DB2 - it's a bit tricky. There is a driver written in go, but it's not supported by dburl dependency, so a pull request is needed on the upstream.

These drivers are rather specific, and aren't available out of the box, but it's not difficult to add them (one of them at the moment):

  1. add a driver to one of the maps here
  2. generate drivers.go by running make drivers-all command
  3. once drivers.go is generated, you can compile the binary with make build
  4. done.

P.S. You can also create the binary only with custom drivers - populate the list custom, and run make drivers-custom before compiling the binary.

Let me know if you have any questions, I'm happy to assist. 👍

from sql_exporter.

JustNZ avatar JustNZ commented on June 24, 2024 1

Hey @burningalchemist ,

yes seems like the issue was by not using the v2 version of the oracle driver.
Thanks a lot for the lightning fast response and it is working like a charm now.

And keeping this project lightweight does make sense and if there is the possibility to add own drivers then it is more than perfect.

Thanks!

from sql_exporter.

JustNZ avatar JustNZ commented on June 24, 2024

Hey @burningalchemist,
I added the driver you mentioned to custom section, did the make for drivers-custom and after that the build.

After installing the binary and adding oracle://... to the connection string I get the following error on execution of the binary:
sql: unknown driver \"oracle\" (forgotten import?)"

Do you know what I did wrong?
Is there any way for you to add the mentioned oracle driver directly to this project?

from sql_exporter.

burningalchemist avatar burningalchemist commented on June 24, 2024

Hey @JustNZ,

I just tested it, and it works fine. It's also that you need to use github.com/sijms/go-ora/v2. This might be the cause of your issue.

Here's a short screencast, hope it helps:

Kapture.2023-08-22.at.17.08.40.mp4

As for adding oracle driver by default - it's unlikely, since there's no way to test it, it also increases the application footprint, which is against the idea of this app - to be lightweight and simple. It's also a pretty niche solution. I'm also considering moving previously added Vertica and Snowflake drivers off.

I think adding a simple guide to add your own driver is the best option as it gives control and flexibility.

from sql_exporter.

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.