Example JDBC database.yml files and other questions


#1

Could anyone send me some example jdbc database.yml files for these
databases:derby
h2
hsqldb

I don’t have any experience with them and there aren’t already version
of
these in the rails source. Also I’m having trouble finding the jdbc
adapter
for oracle, is it activerecord-oracle_enhanced-adapter? If so why
doesn’t
it follow the naming convention of all the others? Finally it doesn’t
look
like there is a jdbc adapter for DB2, is this just because it hasn’t
ever
been written? I’m putting together the patch to get all these adapter
supported as valid options when a Rails app is created.

Joe


#2

Joseph A. wrote:

Could anyone send me some example jdbc database.yml files for these

here’s an example–a little convoluted.
-=r

common: &common
adapter: mysql
encoding: utf8
host: localhost
socket: <%= %w[/tmp/mysql.sock /var/lib/mysql/mysql.sock
/var/run/mysqld/mysqld.sock
/opt/local/var/run/mysql5/mysqld.sock].detect { |f| File.exists? f } %>
database: substruct_<%= RAILS_ENV %>
username: root
password:

development:
<<: *common

test:
<<: *common

production:
<<: *common

ar_jdbc:
<<: *common
adapter: jdbc
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost/petstore_production
database: petstore_production


#3

On Sat, Jan 31, 2009 at 10:13 AM, Joseph A. removed_email_address@domain.invalid
wrote:

Could anyone send me some example jdbc database.yml files for these
databases:
derby
h2
hsqldb

I think these will be similar to sqlite3, since they’re usually used
as embedded, in memory databases. I know they also have options to run
as standalone database servers, but I’m not as familiar with them
running in those modes. People who are would probably opt for the pure
jdbc adapter with class name and URL, so the default database.yml
settings should be optimized for newcomers.

development:
adapter: jdbch2
database: db/myapp.development

I don’t have any experience with them and there aren’t already version of
these in the rails source. Also I’m having trouble finding the jdbc adapter
for oracle, is it activerecord-oracle_enhanced-adapter? If so why doesn’t
it follow the naming convention of all the others? Finally it doesn’t look
like there is a jdbc adapter for DB2, is this just because it hasn’t ever
been written? I’m putting together the patch to get all these adapter
supported as valid options when a Rails app is created.

We don’t have a jdbcoracle or similar adapter since the oracle driver
is not open source, and we can’t distribute it. So it’s just the same
as you would do for the native oracle adapter, except that you either
have to manually load the activerecord-jdbc-adapter code ahead of
time, or use the ‘adapter:jdbc’ approach.

/Nick

Joe


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#4

I have a rails app that uses Derby and has the database file(s) under
the
development folder under the db folder under the rails root folder. To
make
it work I had to install the activerecord-jdbcderby-adapter gem and in
my
database.yml I have the following:

development:
adapter: jdbcderby
database: db/development

Best regards,
Juan