Discussion:
Webrick source environment variables
mikelb
15 years ago
Permalink
Hey,

I now have SQLAnywhere working *very* sweetly with Ruby on Rails
through Apache using the gem, and thanks to Eric's help.

Now I need to get it working with Webrick so that I can do some
development. Though, I'm getting the same error I was initially with
Apache:

Could not load SQLAnywhere DBCAPI library

This (in Apache) was due to the environment variables not getting
sourced. I put that (on my dev box) in my /etc/init.d/apache2. But
I'm not sure where to put it for Webrick....

Any help would be awesome and appreciated! (A squared).

Thanks!

mikelb
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
mikelb
15 years ago
Permalink
OK, So it's not the environment variables. I've printed them out, and
they appear to be in order.

Anyone have any thoughts about the error?

Many thanks!
mikelb
...
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
Eric Farrar
15 years ago
Permalink
Hey Mikelb,

Can you tell me how and where you are printing out the environment
variables?

Thanks,

- Eric
...
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
mikelb
15 years ago
Permalink
Shoot. I don't remember! Somehow in some debug session...

BUT, actually, I've changed to using the Mongrel server (and still get
the same error). I'd like to use it for runtime debugging. Where can
I start?

Thanks, Eric!

Michael
...
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
e***@gmail.com
15 years ago
Permalink
Hey Michael,

Working on getting my mongrel server up and running. Will post some
answers soon.

- Eric
...
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
Michael Bahnmiller
15 years ago
Permalink
Heh. Thanks Eric!

PS. I'm on Ubuntu, you?
...
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
Eric Farrar
15 years ago
Permalink
Hi Michael,

Yes, I am on Ubuntu as well (10.04.1 to be precise). I am using a
setup with SQL Anywhere 12.0.0.2483 and Rails 2.3.8

I have created a sample app and am using the Mongrel server fine
(starting it both through script/server and mongrel_start). Can you
post what you type to start it, and where the error appears?

Thanks,

- Eric
...
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
Michael Bahnmiller
15 years ago
Permalink
Eric,

I'm using SQL Anywhere 11.0.1.2044 (and the same Rails version as you).
I am also connecting remotely to a SQL Anywhere server (don't know if
that matters).
Here is what my conf/database.yml looks like (sensitive info
removed/changed):



development:
adapter: sqlanywhere

database: NameOfDB
server: server1
commlinks: tcpip(host=***.***.***.***)
connection_name: rails_test
encoding: Windows-1252
username: dba
password: sql



I also use ./script/server to start it.

The error appears in the console as soon as I try to access a page.
Here is the stack:
$ ./script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

Status: 500 Internal Server Error
Could not load SQLAnywhere DBCAPI library

/var/lib/gems/1.8/gems/activerecord-sqlanywhere-adapter-0.1.3/lib/active_record/connection_adapters/sqlanywhere_adapter.rb:35:in
`initialize'
/usr/lib/ruby/1.8/singleton.rb:94:in `new'
/usr/lib/ruby/1.8/singleton.rb:94:in `instance'

/var/lib/gems/1.8/gems/activerecord-sqlanywhere-adapter-0.1.3/lib/active_record/connection_adapters/sqlanywhere_adapter.rb:65:in
`sqlanywhere_connection'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`send'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in
`checkout'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`loop'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`checkout'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in
`checkout'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in
`connection'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in
`retrieve_connection'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in
`connection'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in
`cache'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in
`call'

/var/www/rails/sybase/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call'

/var/www/rails/sybase/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in
`call'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/head.rb:9:in `call'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in
`call'

/var/www/rails/sybase/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in
`call'

/var/www/rails/sybase/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:99:in
`call'

/var/www/rails/sybase/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in
`call'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'

/var/www/rails/sybase/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in
`call'

/var/www/rails/sybase/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in
`run'

/var/www/rails/sybase/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in
`call'

/var/www/rails/sybase/vendor/rails/railties/lib/rails/rack/static.rb:31:in
`call'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:47:in `call'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `each'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `call'

/var/www/rails/sybase/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in
`call'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in
`call'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/chunked.rb:15:in `call'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:67:in
`process'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in
`process_client'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
`process_client'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/var/lib/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:38:in
`run'
/var/www/rails/sybase/vendor/rails/railties/lib/commands/server.rb:111
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
./script/server:3





Any thoughts? Did you have to source the Env vars somehow, or did you
just install everything? Did you have to edit any other files? Or
maybe this has to do with the difference of versions?

I am running Apache2 with this just fine (but I had to source the env
vars in the apache init.d script)

Thanks!!!
Michael
...
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
Eric Farrar
15 years ago
Permalink
I didn't modify any files, but I did source the SQL Anywhere setup
script (sa_config.sh) in the shell before running script/server. Can
you give me the results of:

echo $LD_LIBRARY_PATH

Thanks,

- Eric

On Aug 18, 12:09 pm, Michael Bahnmiller
...
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
Michael Bahnmiller
15 years ago
Permalink
Hey, Eric,

Thanks to your playing around, it got me thinking, and I finally figured
out a workaround.

I'm actually not running ./script/server directly, but rather through a
vim script in order to use a debugger. Somehow the vim script wasn't
pulling the variables, soooo..... I put them directly into the vim
script (since I couldn't figure out how to source the .sh file).

Now I have it working satisfactorily.

Thanks, once again, for your help Mr Eric. :)

Michael
...
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
Loading...