From: Jochen Kaechelin Date: 2006-12-13T03:41:58+09:00 Subject: Re: connect to MySQL Database Kashia Buch schrieb: > Hi, > >> I run Mac OS X Tiger, ruby 1.8.4 (from sources) and MySQL 5.0.27 (from >> sources). >> >> I wan't to create a script which is called by pure-ftpd's uploadscript >> functionality - clamav scans each uploaded file - and store the scan >> results directly into a MySQL database. >> >> What's the recommended way to do this? > > I would do it along these lines (untested): > > > require 'og' > # http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/165163 > require 'clamscanner' > > class ClamavScanResult > is Timestamped > property :path, String > property :result, Result > end > > Og.start(:store => :mysql, :name => 'clamavdb', :user => 'testuser', > :password => 'private', :classes => [ClamavScanResult]) > > # scan this file > file = ARGV[0] # first argument is the file/path ? > clamav = ClamScanner.new > res = clamav.scan( file ) > > ClamavScanResult.create_with(:path => file, :result => res) > > __END__ Great, I will give it a try. Seems to be exactly what I need. But what do I need to connect to a MySQL database? Has ruby no native MySQL support. Do I need to install extra modules, libs ?? -- Jochen