blob: 93a0120a6ced203521fb054e3187a2b1df5e03d1 [file] [log] [blame]
#!/bin/env jruby
require 'java'
#include_class 'java.lang.Class'
include_class 'java.sql.DriverManager'
include_class 'com.mysql.jdbc.jdbc2.optional.MysqlDataSource'
require 'jdbc'
require 'format'
## ds = MysqlDataSource.new()
## ds.setUser(ENV['SDB_USER'])
## ds.setPassword(ENV['SDB_PASSWORD'])
## ds.setURL("jdbc:mysql://localhost/information_schema")
## ds.getConnection()
##
## c = JDBC::DB.new(ds.getConnection())
c = JDBC::DB.connect("jdbc:mysql://localhost/information_schema",
"com.mysql.jdbc.Driver",
ENV['SDB_USER'],
ENV['SDB_PASSWORD'])
q = <<EOQ
SELECT DISTINCT table_schema, engine
FROM TABLES
WHERE table_schema != 'information_schema'
AND table_schema != 'mysql'
EOQ
c.query_print(q)
c.close