On Monday, July 29, 2013 5:03:40 AM UTC-6, Christian MICHON wrote:
>
> Hi,
>
> I see 3 possible solutions:
> - package sqljdbc4.jar into a gem, include this gem in your Gemfile, and
> call sequel binary using 'bundle exec sequel -m ...'
> - write a dedicated script like your first script, tweak ARGV and call
> sequel binary using Gem.bin_path
> - write a dedicated script like your first script and call
> Sequel::Migrator directly
>
> If you plan to reuse this in many projects, I suggest solution 1.
> Solution 2 is easiest but dirty fix.
> Solution 3 is best if no reuse.
>
> Solution 1: please use google on how to craft gems :-)
> There are many approaches on this: I would suggest you to use bundler to
> generate an empty Gem skeleton, copy sqljdbc4.jar in lib and modify main
> ruby file to require java and sqljdbc4.jar
>
> Detailed solution 2:
> %w[rubygems bundler/setup java sqljdbc4.jar sequel].each { |i| require
> i }
> Java::com.microsoft.sqlserver.jdbc.SQLServerDriver
> ARGV=%w[-m db/migrate jdbc:sqlserver://10.10.10.110
> ;databaseName=extract;user=username;password=secret] # quotes can be
> removed, trailing semicolon also (untested)
> load Gem.bin_path('sequel','sequel')
>
> Detailed solution 3:
> %w[rubygems bundler/setup java sqljdbc4.jar sequel].each { |i| require
> i }
> Java::com.microsoft.sqlserver.jdbc.SQLServerDriver
> db = Sequel.connect('jdbc:sqlserver://10.10.10.110
> ;databaseName=extract;user=username;password=secret')
> Sequel.extension :migration
> Sequel::Migrator.run db, 'db/migrate'
>
> Please note I've not tested this on Sequel 4, so minor tuning might occur.
>
> Good luck.
> Christian
>
> In the short term, I am using this script that hard codes the connection.
I will look into writing a gem to make this usable for multiple projects.
#############
require 'rubygems'
require 'bundler/setup'
require 'java'
require 'sqljdbc4.jar'
require 'sequel'
Sequel.extension :migration
Java::com.microsoft.sqlserver.jdbc.SQLServerDriver
DB =
Sequel.connect('jdbc:sqlserver://10.10.10.110;databaseName=extract;user=username;password=secret;')
Sequel::Migrator.apply(DB,'./migrate')
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.