-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to seperate the ODBC connector and SQL Query #474
Comments
# my_db.rb
class MyDb
def self.conn
Mysql2::Client.new(:host => "192.168.10.1", :username => "username", :password => "password", :port => 1234, :database => "database name" )
end
end
# work_file.rb
require 'my_db'
db = MyDb.conn
db.query('stuff')
db.close |
Hi @MartynKeigher! If I'm understanding you correctly, @indirect's solution should work for what you need. Have you given that a try? |
Hey, Just so its recorded and here for reference for anyone else that needs to know. Note: Both of the RB files are in the SAME folder. ./my_db.rb
./agentcount.rb
Thank you again!! |
Hey all,
So I have been working at this for a little while now and I'm struggling to see where I am going wrong, so I'm going to jump straight in... This is my current rb file to pull data from a MySQL db.
And it works fine! So far so good.
What I am looking to do is SPLIT the function of this RB so i have 2 files. One file is the SQL Query, and the other is the ODBC conenctor, basically the
part, and then I want to be able to call the "odbc connector file' from my rb job file that is actually doing the querying of the db.
Make sense? I hope it does, and i'm pretty sure its something simple... but I'm just not getting it to work for me and I would really appreciate someone's response to this.
Many Thanks!
Martyn T. Keigher
The text was updated successfully, but these errors were encountered: