Forum: JRuby rake db:migrate error

Posted by Veerendra P. (veerendra_p)
on 2013-01-31 12:44
I am new to Ruby and trying to configure jruby development environment
on laptop using existing Jruby source code.if i run rake db:migrate
getting below error.

please help me for resolving the error.i have stucked in this since 2
weeks.

details are below

Jruby version -1.5.0
Gem        1.3.6

Rails     2.3.8

Rake 0.9.2.2

WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require
'rdoc/tas
k' (in RDoc 2.4.2+)' instead.
    at
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rdoctas
k.rb
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
The driver encountered an error:
com.microsoft.sqlserver.jdbc.SQLServerException
: The TCP/IP connection to the host  has failed.
java.net.ConnectException: Conn
ection refused: connect
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java
/lib/active_record/connection_adapters/jdbc_adapter.rb:344:in
`initialize'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java
/lib/active_record/connection_adapters/jdbc_adapter.rb:476:in `new'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java
/lib/active_record/connection_adapters/jdbc_adapter.rb:476:in
`initialize'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java
/lib/active_record/connection_adapters/jdbc_adapter.rb:49:in `new'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java
/lib/active_record/connection_adapters/jdbc_adapter.rb:49:in
`jdbc_connection'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection
'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_pool.rb:188:in `checkout'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_pool.rb:184:in `loop'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_pool.rb:184:in `checkout'
D:/jruby/jruby-1.5.0/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_pool.rb:98:in `connection'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_specification.rb:123:in
`retrieve_conne
ction'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/connection_adapters/abstract/connection_specification.rb:115:in
`connection'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/migration.rb:440:in `initialize'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/migration.rb:401:in `new'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/migration.rb:401:in `up'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record
/migration.rb:383:in `migrate'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake
:112
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
 `call'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
 `execute'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
 `each'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
 `execute'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in
 `invoke_with_call_chain'
D:/jruby/jruby-1.5.0/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
 `invoke_with_call_chain'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in
 `invoke'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb
:116:in `invoke_task'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb
:94:in `top_level'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb
:94:in `each'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb
:94:in `top_level'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb
:133:in `standard_exception_handling'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb
:88:in `top_level'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb
:66:in `run'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb
:133:in `standard_exception_handling'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb
:63:in `run'
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
D:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:19:in
`load'
D:\jruby\jruby-1.5.0\bin\rake:19
Tasks: TOP => db:migrate
Posted by Hassan Schroeder (Guest)
on 2013-01-31 16:53
(Received via mailing list)
On Thu, Jan 31, 2013 at 3:44 AM, Veerendra P. <lists@ruby-forum.com> 
wrote:
> I am new to Ruby and trying to configure jruby development environment
> on laptop using existing Jruby source code.if i run rake db:migrate
> getting below error.
>
> please help me for resolving the error.i have stucked in this since 2
> weeks.

> Jruby version -1.5.0
> Gem        1.3.6
> Rails     2.3.8
> Rake 0.9.2.2

Ouch, all pretty old, but I'll assume you're trying to get legacy
app going to start the upgrade ;-)

> rake aborted!
> The driver encountered an error:
> com.microsoft.sqlserver.jdbc.SQLServerException
> : The TCP/IP connection to the host  has failed.
> java.net.ConnectException: Connection refused: connect

Either your DB configuration info is wrong, or you have a firewall
or something blocking the DB connection.

Can you ping the DB host? Connect manually with any other tool, .
using the info from config/database.yml ?

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Posted by Keith B. (keith_b)
on 2013-01-31 17:10
(Received via mailing list)
Veerendra -

The connection refused error implies that it's a configuration error 
rather than a source code or logic error.

This can be verified by using the connection information you specified 
in config/database.yml to access your data base using a different client 
program (is there a SQLServer client app?  I don't know).

It could be a bad user id, password, host name/address, or even a 
firewall issue on your data base server.  Is the db server on your local 
machine, or another one?  And have other applications and/or other 
machines connected to it successfully?

If this doesn't help you could post your database.yml file and maybe 
something would get our attention. However, when you post more than a 
few lines of code, please use a service like gist.github.com to post 
your code.  Including a long listing directly in a message in a public 
forum is not encouraged.

Also, do you need to use old versions?  JRuby's current version is 
1.7.2, rake is 10.0.3, and Rails is up to 3.2.11.  Also, if you're using 
JRuby 1.5 in its default mode, then you're using the Ruby language in 
its 1.8 mode.  I'd recommending updating to use 1.9 mode.  This happens 
automatically with recent versions such as 1.7.2 (that is, 1.9 is the 
default language mode).

Regards,
Keith

---
Keith R. Bennett
http://about.me/keithrbennett
Posted by Veerendra P. (veerendra_p)
on 2013-02-03 09:33
Hi Keith,

Thanks for reply,

by enabling tcp/ip port for sqlserver  the above issue has been 
resolved.

and giving an error related to datatype like below.

"ActiveRecord::ActiveRecordError: Column, parameter, or variable #2:
Cannot find
data type date.: CREATE TABLE reviews ([id] int NOT NULL IDENTITY(1, 1)
PRIMARY
KEY, [date] date, [freezed] bit DEFAULT 0, [project_id] int,
[created_at] dateti
me, [updated_at] datetime)"

the schema file for the table is :
create_table "reviews", :force => true do |t|
    t.date     "date"
    t.boolean  "tmp_freezed",       :default => false
    t.integer  "project_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "mom_id"
    t.string   "tmp_status_backup"
    t.integer  "tmp_author_id"
    t.integer  "reviewer_id"
    t.string   "status"
    t.text     "stats"
    t.integer  "author_id"
  end

Please help me to resolve the error from the above code.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.