The Sybase Gem is Buggy...

11 views
Skip to first unread message

Anthony Kelly

unread,
Jan 17, 2008, 6:47:47 PM1/17/08
to Ruby On Rails Sybase Developers
There are issues in the Sybase Adapter(now a gem) in RoR. I was
wondering if there were any active record experts out there who could
look at the patches and make sugguestions/+1 them. Here are the
links:

Adapter doesn't reconnect if database shuts down:
http://dev.rubyonrails.org/ticket/8400

Adapter unnecessarily accesses 'syscoments' which is often a
restricted resource in the industry:
http://dev.rubyonrails.org/ticket/10629

Let me know if you are willing to help or know someone who might be.

jrun

unread,
Jan 18, 2008, 8:21:39 AM1/18/08
to Ruby On Rails Sybase Developers
I hope to get some time to help verify these patches sometime soon.

Note, i've closed this ticket:
http://dev.rubyonrails.org/ticket/6878

The bug was fixed as part of a larger patch done by John Sheets for
Rails 1.2.
Message has been deleted

John Sheets

unread,
Jan 18, 2008, 10:32:53 AM1/18/08
to Ruby On Rails Sybase Developers
Sorry for the slow response. I looked over the two issues and no
problems immediately leap out. I haven't had the chance to test
either one, but if they don't break the adapter for anyone, I say go
for it.

Regarding the use of syscomments, that's probably just a relic of the
original Sybase adapter patch (http://dev.rubyonrails.org/ticket/2030)
upon which I based my version. I had cleaned up that query a bit, but
apparently not enough.

John

Bryan.La...@gmail.com

unread,
Jan 18, 2008, 11:21:20 AM1/18/08
to Ruby On Rails Sybase Developers
The Sybase Gem...is it purely for ASE or can it work with SQLAnywehre
(former ASA) as well?

John Sheets

unread,
Jan 18, 2008, 11:44:38 AM1/18/08
to ruby-on-rails-s...@googlegroups.com
On Jan 18, 2008 10:21 AM, Bryan.La...@gmail.com <Bryan.La...@gmail.com> wrote:

The Sybase Gem...is it purely for ASE or can it work with SQLAnywehre
(former ASA) as well?

The current Sybase *adapter* gem uses the sybase-ctlib (http://raa.ruby-lang.org/project/sybase-ctlib/) Ruby wrapper around the (non-Ruby) Sybase libct.so (?) library. Actually, sybase-ctlib has compiled C code to provide a binding from libct to its Ruby wrapper.  It's a tar.gz distribution; to my knowledge sybase-ctlib does not exist as a gem.

I've only ever installed sybase-ctlib on Mac and Sun UNIX, never on Windows, though in theory it might be possible.

So, to clarify, the Rails Sybase adapter is a single Ruby source file that is packaged as a gem.  This Sybase adapter depends on the Ruby/C sybase-ctlib library, which is not (?) a gem.  Depending on how close the SQLAnywhere driver is to libct, you might be able to port/convert the sybase-ctlib code to your use.

I don't know of any all-Ruby Sybase database adapters.  Another alternative is to use JRuby and its JDBC adapter with JConnect or jTDS.

John

--
"The Internet is not something you just dump something
on.  It's not a big truck.  It's a series of tubes."
--Senator Ted Stevens, R-AK

John R. Sheets
http://bark.metacasa.net

Bryan.La...@gmail.com

unread,
Jan 18, 2008, 11:59:28 AM1/18/08
to Ruby On Rails Sybase Developers
I am currently working for Sybase iAnywhere and we are looking to
support a SQLAnywhere driver for the RoR community. We were looking at
possibly trying to create one from scratch and details on hwo to go
about doing that have been a little sketchy at best. Can you John, or
anyone else , descripe in a few paragraphs how exactly this process is
to be done either using a C implementation (which is preffered) or
using DBI?

Bryan Lahartinger

Sybase iAnywhere

John Sheets

unread,
Jan 18, 2008, 2:40:27 PM1/18/08
to ruby-on-rails-s...@googlegroups.com
On Jan 18, 2008 10:59 AM, Bryan.La...@gmail.com <Bryan.La...@gmail.com> wrote:

I am currently working for Sybase iAnywhere and we are looking to
support a SQLAnywhere driver for the RoR community.

Great news!
 
We were looking at
possibly trying to create one from scratch and details on hwo to go
about doing that have been a little sketchy at best. Can you John, or
anyone else , descripe in a few paragraphs how exactly this process is
to be done either using a C implementation (which is preffered) or
using DBI?

All I know is that the low level Sybase driver was already done by someone else (http://raa.ruby-lang.org/project/sybase-ctlib/ ).  It's pretty cryptic, unless you know the Sybase C API (which I don't).  You'll need a layer of C code to bind the Sybase C library to your Ruby wrapper implementation.  Something like this:

  Ruby -> Ruby C API -> Sybase C API

You can probably learn a lot by studying the ctlib code.  Looks like there are some docs on the Ruby C API here:


John
 

Bryan.La...@gmail.com

unread,
Jan 18, 2008, 2:48:59 PM1/18/08
to Ruby On Rails Sybase Developers
see thats a pretty big misconception amunst this community
anyway....SQL ANywhere is a COMPLETELY differnt database then ASE
which ahs a way different c library....or so I believe so far...The C
API for SQL Anywhere is by using ESQL (Embedded SQL) which is really
nice and easy to use and compile with C++.NET
The process is taking your C code with the ESQL inside, run the SQL
preprocessor which translates everything into c++ code then obj
then .exe as a normal c++ app. This is all easily done through nmake
(make files for windows!:D) All SQL statements including ESQL
statements can be found here:http://www.ianywhere.com/developer/
product_manuals/sqlanywhere/1000/en/html/dbrfen10/rf-syss.html

On Jan 18, 2:40 pm, "John Sheets" <metac...@gmail.com> wrote:
> On Jan 18, 2008 10:59 AM, Bryan.Lahartin...@gmail.com <
>
> Bryan.Lahartin...@gmail.com> wrote:
>
> > I am currently working for Sybase iAnywhere and we are looking to
> > support a SQLAnywhere driver for the RoR community.
>
> Great news!
>
> > We were looking at
> > possibly trying to create one from scratch and details on hwo to go
> > about doing that have been a little sketchy at best. Can you John, or
> > anyone else , descripe in a few paragraphs how exactly this process is
> > to be done either using a C implementation (which is preffered) or
> > using DBI?
>
> All I know is that the low level Sybase driver was already done by someone
> else (http://raa.ruby-lang.org/project/sybase-ctlib/). It's pretty cryptic,

Anthony Kelly

unread,
Jan 18, 2008, 2:58:12 PM1/18/08
to ruby-on-rails-s...@googlegroups.com
So have you started writing an ASA adapter yet? I know we have ASE but
I'm not sure about SQL Anywhere.

Bryan Lahartinger

unread,
Jan 18, 2008, 3:41:05 PM1/18/08
to Ruby On Rails Sybase Developers
In the process of figuring out the details and designing the
implementation. At this stage I'm gathering as much information as
possible and have tried playing around with preliminary concepts.

-Bryan L

On Jan 18, 2:58 pm, "Anthony Kelly" <vaxin...@gmail.com> wrote:
> So have you started writing an ASA adapter yet? I know we have ASE but
> I'm not sure about SQL Anywhere.
>

Anthony Kelly

unread,
Jan 18, 2008, 6:10:40 PM1/18/08
to Ruby On Rails Sybase Developers
http://raa.ruby-lang.org/project/sybase-ctlib/ seems to have some
version of the source for CTLib.

On Jan 18, 3:41 pm, Bryan Lahartinger <Bryan.Lahartin...@gmail.com>
wrote:

John Sheets

unread,
Jan 19, 2008, 10:48:54 AM1/19/08
to ruby-on-rails-s...@googlegroups.com
On Jan 18, 2008 5:10 PM, Anthony Kelly <vaxi...@gmail.com> wrote:

http://raa.ruby-lang.org/project/sybase-ctlib/   seems to have some
version of the source for CTLib.

Technically it just has the C code for the Ruby C bindings that connect to CTLib.  IIRC, CTLib is bundled with Sybase databases and is typically used for command-line tools, e.g. isql.

John

Anthony Kelly

unread,
Jan 22, 2008, 11:04:55 PM1/22/08
to Ruby On Rails Sybase Developers
Oh ok that makes sense. Has anyone been able to compile this on
windows?

On Jan 19, 10:48 am, "John Sheets" <metac...@gmail.com> wrote:

jrun

unread,
Jan 23, 2008, 7:24:49 AM1/23/08
to Ruby On Rails Sybase Developers
Yes.

Here are the instructions (and a link to the binaries):
http://wiki.rubyonrails.com/rails/pages/SybaseASEonWin32

I used to host the binaries but it looks like they are now available
here:
http://www.flesaker.no/software/sybase-ctlib/
Reply all
Reply to author
Forward
0 new messages