Uploaded image for project: 'Puppet Server'
  1. Puppet Server
  2. SERVER-969

Calling jbdc-mysql inside puppetserver jruby

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DOCS
    • Labels:
      None
    • Environment:
    • Template:

      Description

      Hello,

      In a erb file, we were using the Mysql DBI driver. It works great within a puppetmaster environment. But I can't get this erb file working inside puppetserver.

      After reading link native-c-extension, I've switched to jdbc/mysql. But I can't get it working.

      Here a simple code that didn't run inside a puppserver

      require 'dbi'
      require 'dbd/Jdbc'
      require 'jdbc/mysql'
      Jdbc::MySQL.load_driver
      DBI.connect('dbi:jdbc:mysql://localhost/test', 'username', 'password', 'driver' => 'com.mysql.jdbc.Driver') do |dbh|
      puts "Connected"
      end

      It gives:

      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Failed to parse template test.erb:
      Filepath: /opt/puppetlabs/server/data/puppetserver/jruby-gems/gems/dbd-jdbc-0.1.6-java/lib/dbd/jdbc/driver.rb
      Line: 66
      Detail: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/test
      at /etc/puppetlabs/code/environments/ohanesse/modules/test/manifests/ohanesse.pp:7:16 on node test-*
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run

      I've tried to add the 'mysql-connector-java-5.1.36-bin" jar file to the classpath (using -cp in the command line), same error.

      Any ideas ?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Olivier Hanesse Olivier Hanesse
                QA Contact:
                Erik Dasher
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support