Sha256: f311604a8b3e771905de30ac6302a238c9ad85ec6441dbdaf10cd294e750d5f6
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
def create_odbc_connection( details ) `odbcconf /A {configdsn "SYBASE ASE ODBC Driver" "DSN=#{details[:odbc_name]}|NA=#{details[:hostname]},#{details[:port]}|Uid=#{details[:username]}|Pwd=#{details[:password]}|Database=#{details[:db_name]}"}` end def prompt_for_connection_details result = {} print "Please enter the odbc name you want to create: " result[:odbc_name] = gets.rstrip print "Please enter the hostname of the database you want to connect to: " result[:hostname] = gets.rstrip print "Please enter the port number to connect to on #{result[:hostname]}: " result[:port] = gets.rstrip print "Please enter db name on #{result[:hostname]}:#{result[:port]} to connect to: " result[:db_name] = gets.rstrip print "Please enter the username for #{result[:db_name]}: " result[:username] = gets.rstrip print "Please enter the password for #{result[:db_name]}: " result[:password] = gets.rstrip return result end @more_connections_prompt = "\n\nAlright Chopper, are you ready to create some ODBC connections? y/n " def prompt_for_another_connection? print @more_connections_prompt return gets.rstrip.eql?( 'y' ) end while( prompt_for_another_connection? ) @more_connections_prompt = "\n\nWant to create some more ODBC connections? y/n " details = prompt_for_connection_details create_odbc_connection( details ) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
marjoree-0.0.9 | ./bin/create_odbc_connections.rb |