Connecting to a database with Ruby on shared hosting without ssh
So, I'm learning Ruby and I'm trying to write a sim开发者_如何学Pythonple Sinatra app. Problem is, from what I'm gathering there's no database drivers included with Ruby and I can't install the MySQL driver that I found without ssh. Is there another option?
I presume from your question that you cannot install the mysql gem because you don't have ssh access, and hence can't run gem install mysql from the command line? If so, presumably you're uploading your application via FTP or similar?
If so, one possible approach would be to cross-compile the mysql native extension on your home machine, for the target architecture of your host, and then vendor the mysql gem into your application before uploading it to your host. As an alternative, it might be possible to find pre-built native extensions (although I haven't looked for any).
Needless to say, this is a pretty round-about and involved route. A better option would be to find a shared host that supported Rails/Sinatra better. I have found site5.com to be excellent and competitive, but I'm sure that there are others.
精彩评论