Reading MS Access database in windows with ruby from mac - ruby-on-rails

I have a rails application running on mac and an MS Access database located on windows server PC which data are changing daily.
Both may mac and windows PC are in the same network and also I have permission to connect to server remotely by telnet.
How may I just read data from my mac using ruby to publish it?

In database.yml, you should configure the db parameter, like adapter, host, port, username, password. I am not sure if there is Access DB adapter for Rails. And then, you can create your models corresponding to the DB tables. Please refer to this
I did the almost same thing, except I use Sqlite tables in local host and PSQL tables in remote server in development. Ater you finish the configure and models creation, you can use the model as normal, almost no any difference.

Related

Rails app database connection with SQL GUI application on localhost

I'm developing rails app on windows 10. I want a GUI for default sqlite database for my app, for this I've downloaded SQLyog software: https://www.webyog.com/
Now SQLyog is asking for some credentials (e.g. host, username, password, port) to connect to my rails app database. Here, I don't know where to find these credentials for my app database.
I've checked database.yml file but there is no such information. Where do I find this information?

Rails still hitting old database IP, even after restarting apache

I have a Rails app on a windows machine that also has a SQLServer that it used to use as it's database.
However I am trying to transition the app to use a new SQL server on a different Windows machine.
The new Machine is reachable (ping)
After changing the database.yml file with the new IP I can go into Rails console and make queries on the new machine.
However, Running the code still queries the local(old) database.
I have restarted apache.
This is driving me nuts. Why is my code still hitting the old configuration? Do I need to restart the machine completely?
Thanks
Just Try printing the TARGET_ENV and the URI that you are targeting in the Ruby code. It will tell you which IP is being hit everytime.

Want to connect to local database from java application on server

I have a local Ms access database in a local computer connected with internet with dynamic IP. And I have a java web application running on web server. How can I connect to Database in local pc with dynamic ip from the java application running on server
You would have to serve it from the client machine using either a local web server or a VPN tunnel.
Possibly a better idea (I mean, anything sounds better than connecting to a client-side DB, right?) would be to have the client upload the database (depending on the size) and then connecting to the server-side copy.

Rails with unixODBC and SQL Server 2000 and FreeBSD

I'm having a problem trying to deploy a Rails application
a FreeBSD server, I am using unixODBC and FreeTDS to
access the database that sits on a server with windows server
Sqlsever 2003 and 2000.
The problem is that the application can only access the database
when using the SA user sqlserver, when I try to use another user,
the application can not access. But when I test the DSN created outside
the application I can access the database with other users,
DSN using the same application.
Does anyone have an idea what might be? Ja I even put the
I created user to access the application with all rights ..
db_owner .. and so on .. and still can not access when I try to run
application with this user.
tanks!
:) Alessandra
I realized that if I omit the user or placing a user who does not exist, but the password being the same as in SA it connects too.

RoR app deployed on Heroku and working with SQL Server database

Is it feasible to have a Ruby on Rails app, which is:
a) deployed on Heroku, and
b) working with a remote SQL Server database?
I take it that I'll need unixODBC installed on Heroku, but I cannot find a way to do so. Is this possible?
Or, is there any other way (without ODBC?) to accomplish this?
Thank you very much for any guidance or tip.
Updated:
Some info on the subject:
1) Heroku pre-installs both unixODBC and FreeTDS by default, so you already have them.
2) Also, it is possible to run shell commands via Heroku Console in backticks, e.g.:
heroku console
`odbcinst`
(runs "odbcinst" command in Heroku shell and shows the result)
3) You do not have access to filesystem outside of your slice where the packages are installed. If you only need a driver path, Heroku support can provide it (/usr/lib/odbc/libtdsodbc.so in my case).
4) You cannot run sudo commands in Heroku shell.
At the moment, to connect to MS SQL Server you at least need to append ‘freetds.conf’ file. Even when using tinyTDS (there is an open ticket#2 in tinyTDS gitgub issue page). DSN-less connection instructions from "wiki.rubyonrails.org SLASH database-support SLASH ms-sql" didn’t work for me, I guess this connection requires some extra-configuration either.
‘freetds.conf’ cannot be modified without sudo. Therefore, I conclude that currently there is no way to make MS SQL and Heroku work together.
I’ve managed to set up this connection with EngineYard and activerecord-sqlserver-adapter.
I followed these instructions:
https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Platform-Installation---Ubuntu
(there are only some filepath differences, e.g. ‘odbc.ini’ is located in ‘/etc/unicodbc’, not in ‘/etc’ - this is easy to work out).
I installed 'unixODBC' and 'freetds' packages using EY Unix Packages feature, and made all configurations manually through SSH. Sudo is available in EY (no password required). There is also Chef Recepes feature to automate those configurations (seems to be pretty easy, I'm going to try it tomorrow).
Hope this is helpful.
It is possible.
Because Heroku copies/symlinks its own config/database.yml over whatever you supply in your repository, you may need to take additional steps (e.g. in config/environments/production.rb or in config/initializers/remote_mssql_from_heroku.rb) to set up your application appropriately.
You will face the challenge, however, that traffic from Heroku to your MSSQL database will traverse the public internet. By default, this traffic will not be encrypted. Potentially everyone in the world will be able to monitor your traffic between your Heroku application and your database, and even alter the traffic in-flight, whether for benign or malicious purpose, without you being able to detect it. MS SQL offers the capability to connect over SSL. This capability requires explicit configuration in the MSSQL server, so you must be able to access and modify that configuration. Additionally, this configuration requires that your client library be up-to-date and capable of talking with MSSQL over SSL. Note that MSSQL server will enforce that your server certificate list a Common Name or Subject Alternative Name exactly matching or wildcard-matching the server's FQDN (at least, the FQDN that the server knows about), and that the client use an FQDN for the server exactly matching or wildcard-matching one of the names on the certificate.
I've successfully used the following article which uses Heroku's newer buildpack feature to use TinyTDS and connect remotely to SQL Server 2008 R2. I'm still investigating how I could encrypt traffic. Hope this helps others!
http://blog.firmhouse.com/connecting-to-sql-server-from-heroku-with-freetds-here-is-how-on-cedar#
We're having a similar problem where we're needing to import old data from a SQL Server database into our new app. The data isn't a straight table import, but needs to undergo some processing and conversions. We've built an import layer for this which lives in a private gem, so as to not pollute the new app with the old data conversion issues. This approach is also designed to permit incremental updates, as we get closer to launch we'll keep syncing records up to the moment of switch-over.
Heroku told us that it's not trivial to connect to SQLServer, in particular as they don't support FreeTDS. Their support staff recommended to run an instance with the import gem from a laptop in our office and configure it to connect to their database (which requires a dedicated DB, not the free shared one). This sounded like the most palatable approach to us.
Secondly, regarding security that was mentioned by #Justice, we discussed configuring SSL for SQLServer with the hosting company and they pointed out the complexities of this. They recommended VPN as an easier solution. As we don't have office-side VPN hardware, the simplest and free solution proved to be an SSH tunnel.
We've set up an SSH tunnel from the laptop to the SQLServer Windows box. That was straightforward. We had CopSSH installed on Windows (which comes with a Linux shell, by the way) and we were able to simply set up a tunnel, having the laptop talk to localhost for its SQLServer connection, i.e.:
ssh -L 1433:localhost:1433 user#windows_server_name
I did not know Heroku has FreeTDS on it? I was told they did not. TinyTDS if used with FreeTDS 0.91 can have a zero freetds.conf dependency and be driving by runtime connection args. We are looking into building an Ubuntu 10.4 native gem that statically links 0.91 with OpenSSL so you can just drop it into Heroku and us it to connect to Azure and/or you own outside DB.

Resources