SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    Europe
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Connection times out

    I am following this tutorial:
    http://www.onlamp.com/pub/a/onlamp/2...ls.html?page=2

    I'm stuck here:

    Run the command: ruby script\server to start the server.
    Now open your browser and browse to http://127.0.0.1:3000/

    I'm stuck because when I type http://127.0.0.1:3000/ in my browser, it
    takes forever to open, and after several minutes it times out. I have
    added the 3000 port to my exception list (tcp & udp) but with no luck.

    The Webricks server is launched normally and doesn't report any error.

    Any idea?
    Thanks,

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the logs in your logs folder under your rails root, see if development.log (unless you're running in a different environment) says anything useful.

  3. #3
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Yakima WA.
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also try http://localhost:3000 instead. What platform are you on?

  4. #4
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm on a windows xp OS with RoR installed, but mysql keeps timing out;

    Code:
    Mysql::Error: Lost connection to MySQL server during query: SELECT COUNT(*) FROM categories
    What do I need to do to make it run mysql?

  5. #5
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats strange. Check out this google search:
    http://www.google.com/search?sourcei...on+to+mySQL%22

    Most people fix the problem by restarting the server, or it just doesn't happen very often.

  6. #6
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    Europe
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using Windows XP Pro SP2 x64

    I tried http://localhost:3000 but it didn't work either

    All the .log files are empty.

    Any idea?

    Thanks,

  7. #7
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've googled it; it has something to do with a missing .dll file or something. The search that xmitchx is to do with generic loss of mysql server issues. I've restarted apache lots of times, I'll try restarting mysql -- although I've also tried restarting computer as a way of restarting everything (ruby, etc) but no matter what I do it keeps reporting "Exception caught"

    ActiveRecord::StatementInvalid in Category#index

    Mysql::Error: Lost connection to MySQL server during query: SELECT COUNT(*) FROM categories

    RAILS_ROOT: C:/Program Files/Apache Group/Apache2/htdocs/ruby/test/public/../config/..
    Application Trace | Framework Trace | Full Trace

    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:180:in `execute'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:322:in `select'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:175:in `select_one'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/database_statements.rb:16:in `select_value'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:518:in `count_by_sql'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:511:in `count'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:167:in `count_collection_for_pagination'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:188:in `paginator_and_collection_for'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:124:in `paginate'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/scaffolding.rb:101:in `list'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/scaffolding.rb:94:in `index'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in `perform_action_without_filters'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:332:in `perform_action_without_benchmark'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in `measure'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescue.rb:82:in `perform_action'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in `process_without_session_management_support'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/session_management.rb:116:in `process'
    C:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in `dispatch'
    C:/Program Files/Apache Group/Apache2/htdocs/ruby/test/public/dispatch.cgi:10

  8. #8
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have nearly fixed the mysql losing connection problem on a windows platform.

    You have to download a mysql.so file and follow steps on:

    http://seagecko.org/thoughts/in-the-...l-and-windows/

    Or just copy/paste the .so file to:

    Code:
    ruby\lib\ruby\site_ruby\1.8\i386-msvcrt directory
    Except... well, now it replaced the mysql lost connection error with something even more bazaar -- another error!

    Code:
    uninitialized constant Mysql
    Why is RoR so hard to install on a Windows OS...?

  9. #9
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by worchyld
    Why is RoR so hard to install on a Windows OS...?
    Because the ideal platform of choice is a *nix/POSIX-compatible platform such as Linux or OSX, for both development and deployment.

    Saying that, I didn't have any problems setting it up on the Windows XP laptop I'm using at the moment. I simply used the Ruby one-click installer, installed Rails and dependencies using RubyGems, and installed MySQL 5. The database connection worked out of the box for me.

  10. #10
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mmm, I'll try upgrading from MySQL 4.x to MySQL 5.x -- many thanks.

    I upgraded, and got it mysql 5 to run, but its still returning the same undefined constant error.

    I'm this close to giving up on RoR -- I might use PHP on Trax instead.
    Last edited by worchyld; Dec 29, 2005 at 07:59.

  11. #11
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by worchyld
    Mmm, I'll try upgrading from MySQL 4.x to MySQL 5.x -- many thanks.

    I upgraded, and got it mysql 5 to run, but its still returning the same undefined constant error.

    I'm this close to giving up on RoR -- I might use PHP on Trax instead.
    It should work with MySQL4 just the same. Give up on RoR if you want but it will be your loss

    Have you tried the Rails mailing list? You might have more luck there for strange, obscure errors. The problem probably isn't with Rails itself, more like some other part of your setup. Are you sure there isn't a pebkas?

  12. #12
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Yakima WA.
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like you don't have the mysql adapter installed correctly. Unfortunately i don't know how to install that part on windows. But I suspect if you do some googling you will find the answer.

  13. #13
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey, does c:\windows\system\libmysql.dll exist?
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  14. #14
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey, does c:\windows\system\libmysql.dll exist?
    It did exist, but not in that folder (was in mysql folder and php folder respectively), I moved the .dll file to the path quoted, restarted apache/ruby and mysql -- but it still complains of the error.

    It sounds like you don't have the mysql adapter installed correctly
    I looked on the web and found a site describing the mysql adapter, but not what to do with it, its a ruby file; do I run ruby file, do I put it in my ruby folder, do I put it in my test program folder in htdocs? It doesn't say.

    I'm gonna try the mysql adapter again.

  15. #15
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I gave up trying to do it manually and uninstalled mysql5, apache2, etc and put on instant rails instead -- after following the instructions I got the test program to run (mycookbook.com) and it seems to be working fine now.

    If you're having trouble with rails, I'd advise you to look at Instant Rails, yes - it does have all apache, mysql, php on there, and I'm gonna have to re-configure everything; but it does look like I have rails working (I won't know until I've done some test programs).

    Although it is a shame I wasn't able to install it cleanly without a system like Instant Rails, I am happy that I've at least made a small but significant step.

    Thanks all for your help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •