# How would I store data to a server?

**URL:** <https://www.ruby-forum.com/t/how-would-i-store-data-to-a-server/100213>\
**Category:** Ruby\
**Created:** [July 27, 2006, 8:58pm UTC](https://www.ruby-forum.com/t/how-would-i-store-data-to-a-server/100213 "2006-07-27T20:58:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmac217](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@rmac217](https://www.ruby-forum.com/u/rmac217)\
**Post date:** [July 27, 2006, 8:58pm UTC](https://www.ruby-forum.com/t/how-would-i-store-data-to-a-server/100213/1 "2006-07-27T20:58:49Z")

</div>

What would be the best way to store data to a remote database like  
postgreSQL from any computer in the world, Is there a lib or binding to  
do this? Or would I have to use ruby on rails with ruby to get this  
effect?

---

<div class="post-metadata">

**Author:** ![rmac217](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@rmac217](https://www.ruby-forum.com/u/rmac217)\
**Post date:** [July 27, 2006, 9:15pm UTC](https://www.ruby-forum.com/t/how-would-i-store-data-to-a-server/100213/2 "2006-07-27T21:15:38Z")

</div>

On Fri, 28 Jul 2006, Ryan M. wrote:

> What would be the best way to store data to a remote database like  
> postgreSQL from any computer in the world, Is there a lib or binding to  
> do this? Or would I have to use ruby on rails with ruby to get this  
> effect?

You absolutely do not have to use Rails to do this.

However, you would be well served to start at the beginning of the  
problem.

Because you say “any computer in the world”, my assumption is that you  
are  
thinking about some sort of web browser based application for  
transfering  
the data. Is this the case, or might your goals be served by a  
graphical  
or command line tool installed on the computer? What kind of data do  
you  
need to transfer?

Once you answer these questions, you can be more effectively guided  
towards your available options.

Kirk H.

---

<div class="post-metadata">

**Author:** ![rmac217](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@rmac217](https://www.ruby-forum.com/u/rmac217)\
**Post date:** [July 27, 2006, 9:18pm UTC](https://www.ruby-forum.com/t/how-would-i-store-data-to-a-server/100213/3 "2006-07-27T21:18:38Z")

</div>

Ok what I am attempting to figure out is; I want to have a gtk windows,  
with said window on startup I want it too connect to a database to  
retrive the user list, clans, and etc. With this data I will sort it out  
on the program display the users clan, members, etc. I need to connect  
to a database on my server but I do not wish to have connection  
passwords and such in the code.

---

<div class="post-metadata">

**Author:** ![rmac217](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@rmac217](https://www.ruby-forum.com/u/rmac217)\
**Post date:** [July 27, 2006, 9:45pm UTC](https://www.ruby-forum.com/t/how-would-i-store-data-to-a-server/100213/4 "2006-07-27T21:45:25Z")

</div>

1. for mysql, there is a c binding and pure ruby binding AFAIK. for  
pgsql and others, I suppose at least binary ones exist.

2. regarding the password: if you do not want to store it in the code,  
you can obviously either ask it from user or do not ask it at all. Or,  
you can provide other means of transferring information than direct db  
connection. That wouldn’t solve the problem with password, but will  
allow you more fine-grained control. I think webservices are good for  
this - using e.g. xmlrpc you can write them pretty easily, both server  
and client (in a few lines of code for each). The server would  
probably need to run under webrick or mongrel or something similar.

J.

---

<div class="post-metadata">

**Author:** ![rmac217](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@rmac217](https://www.ruby-forum.com/u/rmac217)\
**Post date:** [July 27, 2006, 9:35pm UTC](https://www.ruby-forum.com/t/how-would-i-store-data-to-a-server/100213/5 "2006-07-27T21:35:20Z")

</div>

On Fri, 28 Jul 2006, Ryan M. wrote:

> Ok what I am attempting to figure out is; I want to have a gtk windows,  
> with said window on startup I want it too connect to a database to  
> retrive the user list, clans, and etc. With this data I will sort it out  
> on the program display the users clan, members, etc. I need to connect  
> to a database on my server but I do not wish to have connection  
> passwords and such in the code.

I’m sure people can suggest many ways to get you there. A quick and  
easy  
way that occurs to me is to use Drb.

On your server you run a Drb service that provides an API for querying  
that information

Take a look at this tutorial on how to approach something like this:

[http://segment7.net/projects/ruby/drb/introduction.html](http://segment7.net/projects/ruby/drb/introduction.html)

Kirk H.
