# Writing a new specific subproject of the ActiveRecord-JDBC adapter

**URL:** <https://www.ruby-forum.com/t/writing-a-new-specific-subproject-of-the-activerecord-jdbc-adapter/206873>\
**Category:** JRuby\
**Created:** [May 12, 2011, 10:29am UTC](https://www.ruby-forum.com/t/writing-a-new-specific-subproject-of-the-activerecord-jdbc-adapter/206873 "2011-05-12T10:29:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [May 12, 2011, 10:29am UTC](https://www.ruby-forum.com/t/writing-a-new-specific-subproject-of-the-activerecord-jdbc-adapter/206873/1 "2011-05-12T10:29:17Z")

</div>

Hi guys,

Considering the ActiveRecord-JDBC-Adapter project, I am facing the  
challenge  
to make a particular Rails application to persist against a specific  
database. For it, there is currently no specific support in the adapter  
(like for MySQL for instance). Using the generic JDBC approach leads to  
quite a lot errors, since obviously my database is very demanding on  
different things like table name length, etc. - so it has quite a lot  
limitations.

So, I think that if I want to make ActiveRecord talk to my database, I  
would  
probably have to extend the generic AR-JDBC adapter for my DB. Is this  
right, or there are other solutions to this problem ?  
What kind of things can I specify for my DB, within ARJDBC adapter ? Is  
there any API that I have/must conform to ?

Thanks and Kindest Regards,  
Krum.

---

<div class="post-metadata">

**Author:** ![Krum\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b38774/32.png) [@Krum\_B](https://www.ruby-forum.com/u/Krum_B)\
**Post date:** [May 12, 2011, 10:37am UTC](https://www.ruby-forum.com/t/writing-a-new-specific-subproject-of-the-activerecord-jdbc-adapter/206873/2 "2011-05-12T10:37:56Z")

</div>

On May 12, 2011, at 1:28 AM, Krum B. wrote:

> Hi guys,
> 
> Considering the ActiveRecord-JDBC-Adapter project, I am facing the challenge to  
> make a particular Rails application to persist against a specific database. For  
> it, there is currently no specific support in the adapter (like for MySQL for  
> instance). Using the generic JDBC approach leads to quite a lot errors, since  
> obviously my database is very demanding on different things like table name  
> length, etc. - so it has quite a lot limitations.
> 
> So, I think that if I want to make ActiveRecord talk to my database, I would  
> probably have to extend the generic AR-JDBC adapter for my DB. Is this right, or  
> there are other solutions to this problem ?  
> What kind of things can I specify for my DB, within ARJDBC adapter ? Is there  
> any API that I have/must conform to ?
> 
> Thanks and Kindest Regards,  
> Krum.

Sequel has excellent JDBC support for MySQL, MSSQL, Oracle, PostgreSQL,  
etc..  
[http://sequel.rubyforge.org/](http://sequel.rubyforge.org/)

Mike

---

<div class="post-metadata">

**Author:** ![Krum\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b38774/32.png) [@Krum\_B](https://www.ruby-forum.com/u/Krum_B)\
**Post date:** [May 12, 2011, 10:50am UTC](https://www.ruby-forum.com/t/writing-a-new-specific-subproject-of-the-activerecord-jdbc-adapter/206873/3 "2011-05-12T10:50:17Z")

</div>

Thanks,

Seems like a great project. I didn’t know it.

Does it support MaxDB ? Or plain JDBC ? Anything else that can make  
Rails/ActiveRecord talk to MaxDB ?

Kindest Regards,  
Krum.

---

<div class="post-metadata">

**Author:** ![Krum\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b38774/32.png) [@Krum\_B](https://www.ruby-forum.com/u/Krum_B)\
**Post date:** [May 31, 2011, 9:26pm UTC](https://www.ruby-forum.com/t/writing-a-new-specific-subproject-of-the-activerecord-jdbc-adapter/206873/4 "2011-05-31T21:26:37Z")

</div>

OK, I have started my first attempt to write an ActiveRecord JDBC  
adapter  
for MaxDB.  
I followed this link:

> **[GitHub - nicksieger/activerecord-cachedb-adapter: ActiveRecord adapter for...](https://github.com/nicksieger/activerecord-cachedb-adapter/)**
>
> ActiveRecord adapter for Intersystems CacheDb. Contribute to nicksieger/activerecord-cachedb-adapter development by creating an account on GitHub.

But I am getting some troubles with executing the rake db:migrate task.  
The  
problem is that, when an application table must be created in the data  
base,  
the generic version of the AR-JDBC adapter is called, but not mine.

Could you please help me in getting my specific adapter properly plugged  
?

Seems that, after all, a change is needed in the AR-JDBC adapter project  
as  
well - to introduce my specific adapter. Is that right ?

This problem is with an application table. Previously, I had to modify  
the  
schema of the migrations table, so that it is ok with the SQL dialect of  
MaxDB. I did it by modifying the SchemaStatements module, so that I  
could  
try to find all DDL-related places in the code, and override them, but  
this  
is quite ugly I suppose :).

Oh, and if not already clear - I am a very newbie to Ruby 🙂

I am using Rails 2.3.8 and AR-JDBC adapter 1.1.1

Kindest Regards,  
Krum.

---

<div class="post-metadata">

**Author:** ![Krum\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b38774/32.png) [@Krum\_B](https://www.ruby-forum.com/u/Krum_B)\
**Post date:** [June 4, 2011, 7:55am UTC](https://www.ruby-forum.com/t/writing-a-new-specific-subproject-of-the-activerecord-jdbc-adapter/206873/5 "2011-06-04T07:55:46Z")

</div>

It’s alright now. I made some slight changes in my discover.rb, and the  
generic adapter now seems to switch to using mine without any problems.  
There are currently no needs for changing the generic adapter.

Thanks for your support.

Next, we will try to make our adapter use a dynamcially created  
datasource,  
by means of a JNDI look up. As far as I digged into the generic adapter  
sources, this is already available, by specifying the jndi: property in  
database.yml

Best Regards,  
Krum,

---

<div class="post-metadata">

**Author:** ![Krum\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b38774/32.png) [@Krum\_B](https://www.ruby-forum.com/u/Krum_B)\
**Post date:** [June 3, 2011, 6:29pm UTC](https://www.ruby-forum.com/t/writing-a-new-specific-subproject-of-the-activerecord-jdbc-adapter/206873/6 "2011-06-03T18:29:40Z")

</div>

On Tue, May 31, 2011 at 2:26 PM, Krum B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Seems that, after all, a change is needed in the AR-JDBC adapter project as  
> well - to introduce my specific adapter. Is that right ?

The intention is to not need any changes to AR-JDBC. If that’s not the  
case, we’ll need to fix it. Can you give some example code to give me  
an idea of what’s not working when running DDL statements?

> This problem is with an application table. Previously, I had to modify the  
> schema of the migrations table, so that it is ok with the SQL dialect of  
> MaxDB. I did it by modifying the SchemaStatements module, so that I could  
> try to find all DDL-related places in the code, and override them, but this  
> is quite ugly I suppose :).

It’s probably not unheard of for situations like this. If you can  
share the code somewhere, I can suggest other possible approaches.

/Nick

> Oh, and if not already clear - I am a very newbie to Ruby 🙂

No problem! Hope you continue to enjoy it.

/Nick
