# Database Query

**URL:** <https://www.ruby-forum.com/t/database-query/149200>\
**Category:** Ruby\
**Created:** [September 22, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/database-query/149200 "2008-09-22T13:59:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gruzurg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a8b319/32.png) [@gruzurg](https://www.ruby-forum.com/u/gruzurg)\
**Post date:** [September 22, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/database-query/149200/1 "2008-09-22T13:59:39Z")

</div>

Hello.

Im trying to fetch a value from a field in our database, using this  
code.

selected = @site.db.select(“select car from car\_sale where id=402 AND  
email=‘removed\_email\_address@domain.invalid’”)

But this throws the errormessage.  
RemoteDatabase::Error: invalid environment

Does anybody knows how to get a value properly from the db?

Kind regards  
-Erik

---

<div class="post-metadata">

**Author:** ![gruzurg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a8b319/32.png) [@gruzurg](https://www.ruby-forum.com/u/gruzurg)\
**Post date:** [September 22, 2008, 2:11pm UTC](https://www.ruby-forum.com/t/database-query/149200/2 "2008-09-22T14:11:39Z")

</div>

Erik Johansen wrote:

> Im trying to fetch a value from a field in our database, using this  
> code.
> 
> selected = @site.db.select(“select car from car\_sale where id=402 AND  
> email=‘removed\_email\_address@domain.invalid’”)
> 
> But this throws the errormessage.  
> RemoteDatabase::Error: invalid environment
> 
> Does anybody knows how to get a value properly from the db?

You’ll need to provide more info first.

(1) What database access library and version are you using? How did you  
install it? Did you build any parts of it yourself? If so, what commands  
did you use?  
(2) What database and version are you talking to? Can you demonstrate  
the same select query using a CLI client for that database?  
(3) What code did you use to create @site.db?  
(4) What version of Ruby are you running?  
(5) What operating system are you running Ruby under?

(“ruby -v” gives a short answer to (4) and (5))

---

<div class="post-metadata">

**Author:** ![gruzurg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a8b319/32.png) [@gruzurg](https://www.ruby-forum.com/u/gruzurg)\
**Post date:** [September 23, 2008, 1:55am UTC](https://www.ruby-forum.com/t/database-query/149200/3 "2008-09-23T01:55:57Z")

</div>

On Mon, Sep 22, 2008 at 6:51 AM, Erik Johansen  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Does anybody knows how to get a value properly from the db?

You specify here your table and fields, but no mention of the  
database. How are you connecting to the database?

Todd
