ActiveJDBC doesn´t work with Apache Deby Databases

121 views
Skip to first unread message

arafat877

unread,
Feb 28, 2011, 10:19:22 PM2/28/11
to ActiveJDBC Group
Hi !

I created an Apache Derby database witch contains a single table named
employees like this :

create table employees (
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1,
INCREMENT BY 1) PRIMARY KEY,
first_name VARCHAR(56),
last_name VARCHAR(56)
);

I used the test class located at : https://activejdbc.googlecode.com/svn/trunk/examples/ant-example/
and modified it like this :

//Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/
activejdbc", "root", "p@ssw0rd");
Base.open("org.apache.derby.jdbc.EmbeddedDriver", "jdbc:derby:c:/
activejdbc/activejdbc", "root", "root");

of course I add the apache derby jar, now when I´m traying executing
this command : ant run, it returns me this message :

[java] activddbc.DBException: java.sql.SQLException: Table ´EMPLOYEES´
does not have an auto-generated column named ´id´., Query: INSERT INTO
employees (first_name, last_name) VALUES (?, ?), parames ohn,
Doe .......

It looks like ActiveJDBC doesn´t support the Apache Derby Dialect, is
that correct ?

ipolevoy

unread,
Feb 28, 2011, 11:42:35 PM2/28/11
to ActiveJDBC Group
Arafat, currently AJ supports Oracle, MySQL and PostgreSQL

Thanks,
Igor

arafat877

unread,
Mar 1, 2011, 2:10:03 AM3/1/11
to ActiveJDBC Group
hi !

I´m starting to code a dialect for the apache derby, if done, I send
you my patch.

with regards

ipolevoy

unread,
Mar 1, 2011, 3:12:29 AM3/1/11
to ActiveJDBC Group
Arafat, this is great, however keep in mind, that adding a new dialect
also means passing entire test suite against is.
Please, see that this is included.
Also, Derby is a small Java DB, so, please add it as a test level
dependency so that Maven build automatically pulls it in. In other
words, the build must pass all tests against the Derby if you run it
in a Derby profile - see how other databases are integrated in the pom

thanks
igor

Lukas Eder

unread,
Mar 1, 2011, 5:46:52 AM3/1/11
to ActiveJDBC Group
Hi guys

On 1 Mrz., 09:12, ipolevoy <ipole...@gmail.com> wrote:
> Arafat, this is great, however keep in mind, that adding a new dialect
> also means passing entire test suite against is.
> Please, see that this is included.
> Also, Derby is  a small Java DB, so, please add it as a test level
> dependency so that Maven build automatically pulls it in. In other
> words, the build must pass all tests against the Derby if you run it
> in a Derby profile - see how other databases are integrated in the pom

I'm following this a bit as I'm developing a database abstraction tool
that is similar to ActiveJDBC (http://jooq.sourceforge.net). I can
tell you, that with the Derby database, you need to take extra care
about type-safety. Derby is a very strongly typed database. You will
need to explicitly type-cast many of your PreparedStatement
parameters. These things need to be reflected in all integration tests
compatibly with other SQL dialects.

An example: You might not be able to do things like

SELECT ? FROM SYSIBM.SYSDUMMY1

instead you have to write

SELECT cast(? as int) FROM SYSIBM.SYSDUMMY1

this is especially true when NULL values are involved, which have to
have a type attached as well:

SELECT cast(null as int) FROM SYSIBM.SYSDUMMY1

Just my two cents.
Have fun implementing! :-)

Cheers
Lukas

arafat877

unread,
Mar 1, 2011, 9:58:55 AM3/1/11
to ActiveJDBC Group
Hi !

Lukas, I visited your project and I find it very interesting, but did
your project needs an instrumentation phase like AJ do ? and you didn
´t find a quick start tutorial, for example :

creating a database, a table, and doing a simple CRUD operations !!!!

with regards

Lukas Eder

unread,
Mar 2, 2011, 6:12:11 AM3/2/11
to ActiveJDBC Group
Hello

On 1 Mrz., 15:58, arafat877 <arafat...@gmail.com> wrote:
> Lukas, I visited your project and I find it very interesting, but did
> your project needs an instrumentation phase like AJ do ? and you didn
> ´t  find a quick start tutorial, for example :

This turns out to be a jOOQ-related discussion, not related to
ActiveJDBC. I have answered your question here:
http://groups.google.com/group/jooq-user/browse_thread/thread/d5fe34016cb2fc23

Please write to the jOOQ-mailing list for further jOOQ-related
questions
Regards,
Lukas

arafat bouchafra

unread,
Mar 2, 2011, 8:38:19 AM3/2/11
to activejd...@googlegroups.com
ok, I´m sorry, but I just wanted to know why we need the instrumentation in AJ, not to have infos about JOOQ.

So why we don´t put all the methods add by the instrumentation phase to the compiled Model,directly in this one(compiled Model), in the source code by a special tool ? and wht is the difference between adding this methods before the compilation and after the compilation ?

Regards

2011/3/2 Lukas Eder <lukas...@gmail.com>

ipolevoy

unread,
Mar 2, 2011, 2:44:04 PM3/2/11
to ActiveJDBC Group
Arafat, methods added by instrumentation process allow you to write
code like this:

Person.where(...)

The "where" method is static and declared on a class Model, not
Person. In Java static methods are not inherited, hence there is no
way to find out what class is calling a static method from a super
class. If you add all these methods to source code of Person, there is
going to be a horrible code pollution

cheers

On Mar 2, 7:38 am, arafat bouchafra <arafat...@gmail.com> wrote:
> ok, I´m sorry, but I just wanted to know why we need the instrumentation in
> AJ, not to have infos about JOOQ.
>
> So why we don´t put all the methods add by the instrumentation phase to the
> compiled Model,directly in this one(compiled Model), in the source code by a
> special tool ? and wht is the difference between adding this methods before
> the compilation and after the compilation ?
>
> Regards
>
> 2011/3/2 Lukas Eder <lukas.e...@gmail.com>
>
> > Hello
>
> > On 1 Mrz., 15:58, arafat877 <arafat...@gmail.com> wrote:
> > > Lukas, I visited your project and I find it very interesting, but did
> > > your project needs an instrumentation phase like AJ do ? and you didn
> > > ´t  find a quick start tutorial, for example :
>
> > This turns out to be a jOOQ-related discussion, not related to
> > ActiveJDBC. I have answered your question here:
>
> >http://groups.google.com/group/jooq-user/browse_thread/thread/d5fe340...

arafat bouchafra

unread,
Mar 2, 2011, 2:51:59 PM3/2/11
to activejd...@googlegroups.com
Ok Lucas 

but is there a method to do the instrumentation phase without passing by the mvn/ant scripts (don´t tell me to look some link because I done it ;-) )

I want to code some plugin for netbeans that can do the instrumentation phase automaticlly after the save action ( I inform you that when saving a java file in netbeans, that compilation is  done automaticaly, and there is no way to add no thing to to the ant file who do the compilation).

I´m and a lot of people are using the netbeans for its code autocomplition, warning if there is an error, manages the project ....., we cannot develop a java project without an IDE

2011/3/2 ipolevoy <ipol...@gmail.com>
Reply all
Reply to author
Forward
0 new messages