Connecting to DB2 using Ruby on Rails











up vote
0
down vote

favorite












I need to connect to a IBM db2 table using jruby and ruby on rails.
I have managed to do it, but I haven't seen this solution anywhere and I am hoping i can get some feedback on it, or if there is a better approach.




  1. I am using the gem: activerecord-jdbc-adapter (1.3.16)

  2. I added a jar file to my application lib folder, I found the jar file somewhere but I'm not sure where (possibly http://jt400.sourceforge.net/). It is called jt400-9.4.jar


  3. In application.rb, I load the jar file:



    require_relative '../lib/jt400-9.4.jar' if RUBY_PLATFORM == "java"



  4. My database.yml is below at the bottom.



I can open a Rails console and connect to a table and run Raw inserts.
Does this seem correct, should I need to include the jar file when using the activerecord-jdbc-adapter ??



Thanks for the feedback



development:
adapter: as400
url: "jdbc:as400://ipaddess:port"
schema: schema_name
username: username
password: pw









share|improve this question


























    up vote
    0
    down vote

    favorite












    I need to connect to a IBM db2 table using jruby and ruby on rails.
    I have managed to do it, but I haven't seen this solution anywhere and I am hoping i can get some feedback on it, or if there is a better approach.




    1. I am using the gem: activerecord-jdbc-adapter (1.3.16)

    2. I added a jar file to my application lib folder, I found the jar file somewhere but I'm not sure where (possibly http://jt400.sourceforge.net/). It is called jt400-9.4.jar


    3. In application.rb, I load the jar file:



      require_relative '../lib/jt400-9.4.jar' if RUBY_PLATFORM == "java"



    4. My database.yml is below at the bottom.



    I can open a Rails console and connect to a table and run Raw inserts.
    Does this seem correct, should I need to include the jar file when using the activerecord-jdbc-adapter ??



    Thanks for the feedback



    development:
    adapter: as400
    url: "jdbc:as400://ipaddess:port"
    schema: schema_name
    username: username
    password: pw









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I need to connect to a IBM db2 table using jruby and ruby on rails.
      I have managed to do it, but I haven't seen this solution anywhere and I am hoping i can get some feedback on it, or if there is a better approach.




      1. I am using the gem: activerecord-jdbc-adapter (1.3.16)

      2. I added a jar file to my application lib folder, I found the jar file somewhere but I'm not sure where (possibly http://jt400.sourceforge.net/). It is called jt400-9.4.jar


      3. In application.rb, I load the jar file:



        require_relative '../lib/jt400-9.4.jar' if RUBY_PLATFORM == "java"



      4. My database.yml is below at the bottom.



      I can open a Rails console and connect to a table and run Raw inserts.
      Does this seem correct, should I need to include the jar file when using the activerecord-jdbc-adapter ??



      Thanks for the feedback



      development:
      adapter: as400
      url: "jdbc:as400://ipaddess:port"
      schema: schema_name
      username: username
      password: pw









      share|improve this question













      I need to connect to a IBM db2 table using jruby and ruby on rails.
      I have managed to do it, but I haven't seen this solution anywhere and I am hoping i can get some feedback on it, or if there is a better approach.




      1. I am using the gem: activerecord-jdbc-adapter (1.3.16)

      2. I added a jar file to my application lib folder, I found the jar file somewhere but I'm not sure where (possibly http://jt400.sourceforge.net/). It is called jt400-9.4.jar


      3. In application.rb, I load the jar file:



        require_relative '../lib/jt400-9.4.jar' if RUBY_PLATFORM == "java"



      4. My database.yml is below at the bottom.



      I can open a Rails console and connect to a table and run Raw inserts.
      Does this seem correct, should I need to include the jar file when using the activerecord-jdbc-adapter ??



      Thanks for the feedback



      development:
      adapter: as400
      url: "jdbc:as400://ipaddess:port"
      schema: schema_name
      username: username
      password: pw






      ruby-on-rails active-record jdbc db2






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 10 hours ago









      user3437721

      1948




      1948



























          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f207987%2fconnecting-to-db2-using-ruby-on-rails%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f207987%2fconnecting-to-db2-using-ruby-on-rails%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          TypeError: fit_transform() missing 1 required positional argument: 'X'