Sha256: c1272cf4a32cb6cbb1e02bd92afc4185072ca67297e3b84f27954cce7677e6e6
Contents?: true
Size: 1.16 KB
Versions: 29
Compression:
Stored size: 1.16 KB
Contents
require 'fileutils' require 'active_record/connection_adapters/jdbc_adapter' System = java.lang.System Context = javax.naming.Context InitialContext = javax.naming.InitialContext Reference = javax.naming.Reference StringRefAddr = javax.naming.StringRefAddr System.set_property(Context::INITIAL_CONTEXT_FACTORY, 'com.sun.jndi.fscontext.RefFSContextFactory') project_path = File.expand_path(File.dirname(__FILE__) + '/../..') jndi_dir = project_path + '/jndi_test' jdbc_dir = jndi_dir + '/jdbc' FileUtils.mkdir_p jdbc_dir unless File.exist?(jdbc_dir) System.set_property(Context::PROVIDER_URL, "file://#{jndi_dir}") derby_ref = Reference.new('javax.sql.DataSource', 'org.apache.commons.dbcp.BasicDataSourceFactory', nil) derby_ref.add StringRefAddr.new('driverClassName', 'org.apache.derby.jdbc.EmbeddedDriver') derby_ref.add StringRefAddr.new('url', 'jdbc:derby:derby-testdb;create=true') derby_ref.add StringRefAddr.new('username', 'sa') derby_ref.add StringRefAddr.new('password', '') ic = InitialContext.new ic.rebind("jdbc/derbydb", derby_ref)
Version data entries
29 entries across 29 versions & 5 rubygems