ODBC app in Ruby - I don't believe it

On Wednesday, October 06, 2010 02:40:38 am Dave H. wrote:

My current web-app environment is PostgreSQL for the database, Apache &/or
Mongrel &/or WeBrick for the web server (I really don’t understand that
part yet). The ODBC driver has been replaced with some postgres libraries
and the pg gem. Tango has been replaced with Ramaze&Sequel&(mumble).
“Mumble” was originally HAML, but in the end I just scrapped the entire
idea of using a templating engine because I couldn’t stand the
limitations, so now (mumble) is some custom code I wrote for myself.

What limitations? I’m curious.

And, did you try Erector, or something similar? I prefer Haml, but if I
was
finding it “limiting”, I think that’s where I’d go next.

I then spent yet another whole day trying to get Rails to work. I’d heard
such glowing praise for Rails that it took me that long to realize that it
was utterly unsuitable for my web app.

Again, I’m curious – both about what the app was, and when this was.
Rails
has come a long way.

I looked at Sequel,
ActiveRecord, and at least two other ORMs (after figuring out what the
heck an ORM was in the first place and why I would care).

DataMapper?

Either I have to make Ramaze quit playing around with this
stupid Mongrel gizmo and hook directly into Apache,

Trivial – look into Passenger. But I’m trying to answer the “what, not
how”
questions below.

so I can put muliple
websites on the same ($)%&@#@ port, by which I mean, port EIGHTY!

…why?

Assuming this is a requirement, the most flexible approach seems to be
some
sort of reverse proxy. Apache can do it, nginx makes it simple and
lightweight, fairly trivial to just say “Any URL that starts with this
gets
forwarded to this port on localhost.”

The cool part is that you’re then no longer tied to any one webserver,
or even
any one machine.

The annoying part is that it’s maybe more work than it should be to get
a dev
environment setup.

or
Mongrel (or Ramaze, or Innate, or maybe WeBrick, I really haven’t a clue
whose fault this is) has to quit f**king up my redirect URLs by sticking
:7000 at the end, which contaminates the proxy/reverse proxy URL rewrites

Probably Ramaze, or you. Generate relative URLs, or absolute URLs that
start
with / instead of a domain, or hardcode the domain instead of detecting
the
port. I don’t know enough about Ramaze to know how difficult this is.

It would probably be possible to fix this at a lower level, like Rack or
the
webserver itself, to fool Ramaze into thinking it’s running somewhere
else,
but you want the freedom to be able to tell Ramaze what kind of URLs it
should
generate.

Brian C. wrote:

Then you are free to find a tool which is more suitable to your
environment - MS Access perhaps?

Come on, you know that wasn’t my point. Name me five of the top DBs that
don’t have Windows as a primary platform. If the services run there why
should it not be expected that the development tools run there as well?

On Fri, Oct 8, 2010 at 9:09 PM, Ed Reed [email protected] wrote:

Brian C. wrote:

Then you are free to find a tool which is more suitable to your
environment - MS Access perhaps?

Come on, you know that wasn’t my point. Name me five of the top DBs that
don’t have Windows as a primary platform.

Postgres, Oracle, DB2, MySQL, Informix, SAP ERP.


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

On 10/08/2010 02:09 PM, Ed Reed wrote:

Brian C. wrote:

Then you are free to find a tool which is more suitable to your
environment - MS Access perhaps?

Come on, you know that wasn’t my point. Name me five of the top DBs that
don’t have Windows as a primary platform. If the services run there why
should it not be expected that the development tools run there as well?

The development tools provided by the DB vendors do work on the
platforms they support, including Windows. However, those particular
development tools do not include Ruby, Rails, or the gems that
interface with those DBs. Is there something that lead you to believe
otherwise?

-Jeremy

Phillip G. wrote:

Postgres, Oracle, DB2, MySQL, Informix, SAP ERP.

There’s no need to be a smart ass, you knew exactly what I was talking
about.

From their own websites…

Postgres
“Binary packages
Pre-built binary packages are available for a number of different
operating systems: FreeBSD · Linux · Mac OS X · Solaris · Windows”

Oracle
“(11.2.0.1.0)
Download Microsoft Windows (32-bit) File 1, File 2 (2GB) See All
Download Microsoft Windows (x64) File 1, File 2 (2GB) See All
Download Linux x86 File 1, File 2 (2GB) See All
Download Linux x86-64 File 1, File 2 (2GB) See All
Download Solaris (SPARC) (64-bit) File 1, File 2 (2GB) See All
Download Solaris (x86-64) File 1, File 2 (2GB) See All
Download HP-UX Itanium File 1, File 2 (2GB) See All
Download HP-UX PA-RISC (64-bit) File 1, File 2 (2GB) See All
Download AIX (PPC64) File 1, File 2 (2GB) See All”

DB2
“Software DB2 for Linux, UNIX, and Windows”

MySQL
"MySQL Community Server 5.1.51
Select Platform:

Windows (x86, 32-bit), MSI Installer 5.1.51 105.9M
Download
(mysql-5.1.51-win32.msi) MD5: 1eccd54da2caa09dbf4d65e3012c23df
Windows (x86, 32-bit), MSI Installer
Essentials - Recommended"

Informix
“Operating systems supported: AIX, HP Unix, Linux, Macintosh, Sun
Solaris, Windows”

Jeremy B. wrote:

The development tools provided by the DB vendors do work on the
platforms they support, including Windows. However, those particular
development tools do not include Ruby, Rails, or the gems that
interface with those DBs. Is there something that lead you to believe
otherwise?

It’s useless to argue about semantics on this issue in a forum like
this. I’m talking about the thirty thousand foot view of things. If a db
runs on a particular platform and a development tool runs on a the same
platform. I should be able to develop something with that tool and have
it run on that platform.

Don’t start a flame war because you want to pick at a point. It goes
back to what I said earlier, 90% is a number that is too big to ignore.
You can shout all you want about the 10% and you may be absolutely right
about the 10% but it doesn’t change the numbers.

On 10/08/2010 05:46 PM, Ed Reed wrote:

platform. I should be able to develop something with that tool and have
it run on that platform.

Don’t start a flame war because you want to pick at a point. It goes
back to what I said earlier, 90% is a number that is too big to ignore.
You can shout all you want about the 10% and you may be absolutely right
about the 10% but it doesn’t change the numbers.

I’m seriously not trying to pick a fight. Honest. I’m really curious
what lead you to believe that there is a complete Ruby solution for
these DBs and Windows that had any promise of long term support. You
seem to have approached this whole effort with the expectation that
there is a large vendor providing some kind of professional solution
akin to .NET from Microsoft when in fact there is no such beast (at
least not yet).

A 30k foot view of things may lead to misunderstandings by itself but so
can poor or misleading documentation and erroneous Internet memes. If
you can give us an idea of what lead to your misconceptions, maybe we
can try to address those things. That’s all I’m saying.

-Jeremy

On Sat, Oct 9, 2010 at 12:38 AM, Ed Reed [email protected] wrote:

Phillip G. wrote:

Postgres, Oracle, DB2, MySQL, Informix, SAP ERP.

There’s no need to be a smart ass, you knew exactly what I was talking
about.

From their own websites…
[snip list o’vendors]

You should also check the programming language bindings these vendors
supply. You’ll find that Ruby is lacking in pretty much all of them
(Oracle provided a package for Ruby, but I don’t think it’s still
supported; it’s hard to find, anyway), leaving it to the Ruby
community to provide support. And since the Ruby community is
predominantly *NIX oriented, you can’t expect Windows support
automatically.

If Ruby doesn’t fit within your set of constraints (Win7 +ODBC + Web),
move on, and pick something that does (e.g. Win7 + ASP.NET + SQL
Server Express).


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

ah, nothing like a good warm cup of RTFM up in the morning, huh?

On 9 October 2010 16:58, Phillip G. [email protected]
wrote:

If Ruby doesn’t fit within your set of constraints (Win7 +ODBC + Web),

It would be interesting to know how Python fares with these
constraints - it’s been around a bit longer and seems to have better
Windows support.

Charles

You should also check the programming language bindings these vendors
supply. You’ll find that Ruby is lacking in pretty much all of them
(Oracle provided a package for Ruby, but I don’t think it’s still
supported; it’s hard to find, anyway), leaving it to the Ruby
community to provide support. And since the Ruby community is
predominantly *NIX oriented, you can’t expect Windows support
automatically.

FWIW, this is one of the reasons that I recently switched to using JRuby
as my default Ruby implementation - it lets you use the standard JDBC
drivers from proprietary database vendors with a Ruby database library
like Sequel or Active Record. Setup is painless and JRuby has excellent
support for Windows. I’m now a big fan.


Stuart E.
[email protected]

On 8 October 2010 23:54, Jeremy B. [email protected] wrote:

A 30k foot view of things may lead to misunderstandings by itself but so
can poor or misleading documentation and erroneous Internet memes. Â If
you can give us an idea of what lead to your misconceptions, maybe we
can try to address those things. Â That’s all I’m saying.

Yeah, Ed does have a point in that creating a web app that runs on
Windows 7 and talks to multiple ODBC data sources is apparently not a
great experience with Ruby. But that does beg the question: who said
it would be a great experience? Ruby is a great programming
language, but it is by no means perfect. Lacklustre Windows support
has long been a problem, but this is gradually improving thanks to the
efforts of the open source community. The trouble is, open source is
usually just a bunch of people scratching itches and because the Ruby
community is very *nix based, progress on Windows is often slow. In
only 2007, Luis L. took over maintenance of the 1-Click Installer
(now RubyInstaller), and he and the team have made great
transformational strides, but they can’t do everything and therein
lies the rub: folk such as Ed come along and try something, get
frustrated, then go away. But the Ruby community needs experienced
Windows developers in order to help improve the tools on Windows.

Ed, compare this post:
http://blog.mmediasys.com/2008/03/06/is-windows-a-supported-platform-for-ruby-i-guess-not/

to this one:
http://blog.mmediasys.com/2010/09/23/rubyinstaller-what-where-when-1/

Things are getting better, but there’s still a long way to go. Ed, if
you do persevere and manage to hook things up, it would be
tremendously helpful if you could share your solution so that others
may benefit. I would certainly find it very useful indeed to be able
to run an internal webapp that connects to multiple ODBC databases on
Windows.

Charles

Xavier S.:
Rails 3, Ruby 1.9.2, Windows 2008, and SQL Server 2008 Tutorial:

http://rhnh.net/2010/10/10/rails-3-ruby-1-9-2-windows-2008-and-sql-server-2008-tutorial

On Sun, Oct 10, 2010 at 6:48 PM, David [email protected] wrote:

I was going to suggest to the Windows 7 Developer, that using a virtual box
OSE on top Windows 7, with a Linux Guest OS.

Install Ruby and MYSQL on that, happy days.

Since the client wants a Rails app running on Windows, that won’t quite
work. :wink:


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

I was going to suggest to the Windows 7 Developer, that using a virtual
box
OSE on top Windows 7, with a Linux Guest OS.

Install Ruby and MYSQL on that, happy days.

On 10 October 2010 10:00, Stuart E. [email protected] wrote:

[snip list o’vendors]
FWIW, this is one of the reasons that I recently switched to using JRuby as


±------------------------------------------------------------------------------------
David

I have no doubt that in reality the future will be vastly more
surprising
than anything I can imagine. Now my own suspicion is that the Universe
is
not only queerer than we suppose, but queerer than we can suppose.

  • J.B.S. Haldane
    ±------------------------------------------------------------------------------------

On Oct 11, 2010, at 10:05 AM, Matthew K. Williams wrote:

One thing I’ve not seen anyone mention as yet is using jruby for the ruby interpreter. I’ve had decent luck using it under windows. And the jdbc connectors are pretty good, too.

I use JRuby almost exclusively under Windows. One of the great benefits
is that it supports 64-bit runtimes whereas MRI does not yet have a
64-bit runtime for Windows.

Also, the WIN32OLE stuff is coming to JRuby soon. Check out the projects
on github:

http://github.com/enebo/jacob

and

http://github.com/enebo/jrwin32ole

cr

On Mon, 11 Oct 2010, Phillip G. wrote:

On Sun, Oct 10, 2010 at 6:48 PM, David [email protected] wrote:

I was going to suggest to the Windows 7 Developer, that using a virtual box
OSE on top Windows 7, with a Linux Guest OS.

Install Ruby and MYSQL on that, happy days.

Since the client wants a Rails app running on Windows, that won’t quite work. :wink:

One thing I’ve not seen anyone mention as yet is using jruby for the
ruby
interpreter. I’ve had decent luck using it under windows. And the jdbc
connectors are pretty good, too.

Matt

Did you try IronRuby?

It is very easy to work with odbc, appart from interoperating with .net
directly.

Regards,

Eduardo

On Oct 8, 2010, at 0:12 , David M. wrote:

On Wednesday, October 06, 2010 02:40:38 am Dave H. wrote:

My current web-app environment is PostgreSQL for the database, Apache &/or
Mongrel &/or WeBrick for the web server (I really don’t understand that
part yet). The ODBC driver has been replaced with some postgres libraries
and the pg gem. Tango has been replaced with Ramaze&Sequel&(mumble).
“Mumble” was originally HAML, but in the end I just scrapped the entire
idea of using a templating engine because I couldn’t stand the
limitations, so now (mumble) is some custom code I wrote for myself.

What limitations? I’m curious.

I think mostly I would go to the template, and then discover that I’d
need some logic to get it to come out right, so I’d mix that in (which
really clutters things up), and then I’d realize I needed to loop it,
and so I’d move that whole chunk back to the controller. The
deal-breaker came when I found it was apparently impossible to emit HAML
from the controller and have it processed. If I move this chunk of
template back to the controller because of the need to change the output
based on the data, then I had to emit HTML, then convince HAML not to
escape it. So I just went back to HTML in the first place, and cut down
on the number of languages I had to deal with.

And, did you try Erector, or something similar? I prefer Haml, but if I was
finding it “limiting”, I think that’s where I’d go next.

I didn’t find Erector when I was looking. It was mentioned to me
recently, and look at first glance rather a lot like what I built for
myself, so I intend to give it a very close look sometime soon.

I then spent yet another whole day trying to get Rails to work. I’d heard
such glowing praise for Rails that it took me that long to realize that it
was utterly unsuitable for my web app.

Again, I’m curious – both about what the app was, and when this was. Rails
has come a long way.

It’s a program for a pharmaceutical company to track their products,
processing, and inventory. My PostgreSQL schema uses a custom data type
(‘percentage’ which is a numeric(5,2) that cannot be set above 100.00 or
below 0.00), uses UUIDs for the primary keys of most tables, and takes
advantage of PostgreSQL’s “array” datatype to let me eliminate five or
six linking tables, to just name a couple things off the top of my head
that were completely un-create-able from within Rails and ActiveRecord.

I had to add code to Sequel to support UUIDs and arrays as well, but at
least I could figure out HOW.

I looked at Sequel,
ActiveRecord, and at least two other ORMs (after figuring out what the
heck an ORM was in the first place and why I would care).

DataMapper?

That sounds familar. Yea, I think so.

Assuming this is a requirement, the most flexible approach seems to be some
sort of reverse proxy. Apache can do it, nginx makes it simple and
lightweight, fairly trivial to just say “Any URL that starts with this gets
forwarded to this port on localhost.”

You’d think so. I need it because I am using a reverse proxy. However,
the redirect attaches the port number, which the reverse proxy
commands of Apache do not strip back off. The primary webserver is
running Apache, but this site is on a different machine, and the main
machine redirects traffic to it. So from the outside, they go to
‘specific domain,’ which goes to the primary webserver, port 80, with
the target domain in the header, which reverseproxies it to the other
machine on port 7000 (for the production site) or 7010 (for the
demo/test site). And then the redirect occurs, and the client’s web
browser is now trying to get to
http://domain.com:7000/path/to/whatever” which obviously fails.

I’ve tried adding URL rewrite rules in apache to fix them, but the
interaction with the reverse proxy has utterly confounded me.

On Tuesday, October 12, 2010 08:51:21 pm Dave H. wrote:

On Oct 8, 2010, at 0:12 , David M. wrote:

What limitations? I’m curious.

I think mostly I would go to the template, and then discover that I’d need
some logic to get it to come out right, so I’d mix that in (which really
clutters things up), and then I’d realize I needed to loop it, and so I’d
move that whole chunk back to the controller.

Except Haml has looping constructs. There’s also a pretty neat idiom
where you
call a partial from a loop, so you keep your templates small. Unless
your
loops are particularly bizarre, you’d still be looping over something
that
came from your controller, so I don’t think it’s too much code in your
templates. Even if it was, I certainly don’t see how abandoning the idea
of
separating logic from presentation wholesale is better.

The deal-breaker came when I
found it was apparently impossible to emit HAML from the controller and
have it processed.

I’m pretty sure that’s not true, though it’s probably a bad idea and the
code
would likely be ugly.

And, did you try Erector, or something similar? I prefer Haml, but if I
was finding it “limiting”, I think that’s where I’d go next.

I didn’t find Erector when I was looking. It was mentioned to me recently,
and look at first glance rather a lot like what I built for myself, so I
intend to give it a very close look sometime soon.

It’s basically a next-generation Markaby, and I’m guessing that existed
when
you were looking. Ah, well…

below 0.00),
Huh. DataMapper does support custom, user-defined types, though I’m not
sure
how easy it is to do that with an existing adapter. (To give you an
idea,
there is currently a working DataMapper adapter for Google App Engine.)

uses UUIDs for the primary keys of most tables,

Should work. I’m fairly sure I did this with ActiveRecord, too, at one
point,
though i don’t remember how.

and takes
advantage of PostgreSQL’s “array” datatype to let me eliminate five or six
linking tables,

App Engine also has a list type. Support for it is currently workable
but not
great, but I do have plans to implement associations through arrays of
ids at
some point, for example.

Assuming this is a requirement, the most flexible approach seems to be
some sort of reverse proxy. Apache can do it, nginx makes it simple and
lightweight, fairly trivial to just say “Any URL that starts with this
gets forwarded to this port on localhost.”

You’d think so. I need it because I am using a reverse proxy. However,
the redirect attaches the port number,

Yeah, it shouldn’t do that. Either Rails doesn’t, or nginx does strip
that
(unlikely), because I’ve hosted production Rails apps in exactly this
environment – nginx listening on example.com, forwarding to multiple
Mongrels
on various ports, not necessarily on the same machine.

So, probably somewhere in Ramaze.

I’ve tried adding URL rewrite rules in apache to fix them, but the
interaction with the reverse proxy has utterly confounded me.

I don’t remember how, but I know that one thing Apache’s rewrite rules
can do
is pipe URLs to an external program. It’s a trivial protocol (it sends
the URL
on stdin, you give it the new URL on stdout), and that external program
is a
long-running one, so you could even write that in Ruby.

But it seems like it should be much easier to fix this at the source.