Hi!

Yesterday I was working on using ASE as database backed for Turbine
here is what I came to:
Reverse engineering of the database from MySQL over ODBC went
really smooth, and after a bit of tweaking, PD SqlModeler
produced a usable script. You can find it attached to the
message.
Then I tried entered the following into TurbineResource.properties:

database.default.driver=com.sybase.jdbc2.jdbc.SybDriver
database.default.url=jdbc:sybase:Tds:forge:4100/turbine

and

database.adaptor=DBSybase
database.adaptor.DBSybase=com.sybase.jdbc2.jdbc.SybDriver

Please notice the .jdbc2. in driver's package path. I received
jConnect 5.2 along with ASE 11.9.2, and it looks like they changed
package layout.
After making this changes and reloading Turbine I got CDNF exception
on com.sybase.jdbc.SybDriver. This was kind of surprising, because
I checked for all occurances of SybDriver in .properties.
Grepping the sources revealed another reference to
'com.sybase.jdbc.SybDriver'
in src/java/org/apache/turbine/util/db/pool/DB.java.
I don't send a patch for this, because I believe it is a serious bug
to have a config file option sliently overriden by hardcoded value, and this
probably needs redesigning.
I changed the string, touched DBSybase.java (it references DB.DRIVER_SYBASE)
recompiled and reloaded Turbine and ... KABOOM!

Exception: java.lang.Error: Error in BasePeer.initTableSchema(Visitor): The
method com.sybase.jdbc2.tds.RowFormatToken.getTableName(56) has not been
completed and should not be called.
        at java.lang.Throwable.<init>(Throwable.java:96)
        at java.lang.Error.<init>(Error.java:52)
        at org.apache.turbine.om.peer.BasePeer.initTableSchema(BasePeer.java:225)
        at
org.apache.turbine.om.user.peer.TurbineUserPeer.<clinit>(TurbineUserPeer.jav
a:146)
        at org.apache.turbine.om.user.TurbineUser.setUserName(TurbineUser.java:502)
        at
org.apache.turbine.om.user.peer.UserFactory.getUser(UserFactory.java:158)
        at
org.apache.turbine.modules.actions.sessionvalidator.WebMacroSiteSessionValid
ator.doPerform(WebMacroSiteSessionValidator.java:93)
        at org.apache.turbine.modules.Action.perform(Action.java:77)
        at org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:111)
        at Turbine.doGet(Turbine.java:299)

This looks serious, doesn't it? Too bad that the drivers author dropped a
part
of stack trace while rethrowing the exception, so we can't see what calls in
your
code led to this. There is a comment in DBSybase.java about jConnect not
implementing methods needed for ResultSetMetaData, so maybe you were doing
some workaroudns specific to that earlier version of jConnect you were
using.
As of version 5.2, ResultSetMetaData works just fine - after you run a 180kb
TSQL script with lots of stored procedures that comes along with the
distribution.

We hacked a simple servlet for the purprose of testing jdbc and and MetaData
stuff.
It's ugly, yet may be usefull to somebody. Mail me if you want to have a
look on it.
I think about making Turbine/WebMacro version of it, so you can use it as
comparative
example ;)

Right now I have only vague idea how your DB subsystem works so I don't feel
like
digging through the sources. But if someone knows how to get around it, I'll
be
glad to help.

Rafal

----
Sybase_id_table.sql --------------------------------------------------------
--------

/* ============================================================ */
/*   Database name:  TURBINE                                    */
/*   DBMS name:      Sybase AS Enterprise 11.5-11.9             */
/*   Created on:     5/25/00  1:26 PM                           */
/* ============================================================ */

/* ============================================================ */
/*   Table: ID_TABLE                                            */
/* ============================================================ */
create table ID_TABLE
(
    ID_TABLE_ID     int                    not null,
    TABLE_NAME      varchar(255)           not null,
    NEXT_ID         int                    null    ,
    QUANTITY        int                    null    ,
    constraint ID_TABLE_PK primary key (ID_TABLE_ID)
)
go

/* ============================================================ */
/*   Index: TABLE_NAME                                          */
/* ============================================================ */
create unique index TABLE_NAME on ID_TABLE (TABLE_NAME)
go

----
Sybase_users_roles_permissions.sql -----------------------------------------
--------

/* ============================================================ */
/*   Database name:  TURBINE                                    */
/*   DBMS name:      Sybase AS Enterprise 11.5-11.9             */
/*   Created on:     5/25/00  1:26 PM                           */
/* ============================================================ */

/* ============================================================ */
/*   Table: Jobentry                                            */
/* ============================================================ */
create table Jobentry
(
    OID             int                    not null,
    MINUTE          int                    not null,
    HOUR            int                    not null,
    WEEKDAY         int                    not null,
    DAY_OF_MONTH    int                    not null,
    TASK            varchar(99)            not null,
    EMAIL           varchar(99)            null    ,
    constraint Jobentry_PK primary key (OID)
)
go

/* ============================================================ */
/*   Table: Permission                                          */
/* ============================================================ */
create table Permission
(
    PERMISSIONID    int                    not null,
    PERMISSION      varchar(99)            not null,
    constraint Permission_PK primary key (PERMISSIONID)
)
go

/* ============================================================ */
/*   Index: PERMISSION                                          */
/* ============================================================ */
create unique index PERMISSION on Permission (PERMISSION)
go

/* ============================================================ */
/*   Table: UserRole                                            */
/* ============================================================ */
create table UserRole
(
    ROLEID          int                    not null,
    ROLENAME        varchar(99)            not null,
    constraint UserRole_PK primary key (ROLEID)
)
go

/* ============================================================ */
/*   Index: ROLENAME                                            */
/* ============================================================ */
create unique index ROLENAME on UserRole (ROLENAME)
go

/* ============================================================ */
/*   Table: Visitor                                             */
/* ============================================================ */
create table Visitor
(
    VISITORID       int                    not null,
    LOGINID         varchar(32)            not null,
    PASSWORD_VALUE  varchar(32)            not null,
    FIRST_NAME      varchar(99)            not null,
    LAST_NAME       varchar(99)            not null,
    ADDRESS1        varchar(255)           null    ,
    ADDRESS2        varchar(255)           null    ,
    CITY            varchar(255)           null    ,
    STATE           varchar(32)            null    ,
    POSTALCODE      varchar(32)            null    ,
    COUNTRY         varchar(99)            null    ,
    CITIZENSHIP     varchar(32)            null    ,
    PHONE           varchar(32)            null    ,
    ALTPHONE        varchar(32)            null    ,
    FAX             varchar(32)            null    ,
    CELL            varchar(32)            null    ,
    PAGER           varchar(32)            null    ,
    EMAIL           varchar(99)            null    ,
    MODIFIED        timestamp              not null,
    CREATED         char(10)               null    ,
    LASTLOGIN       timestamp              not null,
    OBJECTDATA      char(10)               null    ,
    PREFIX_NAME     varchar(16)            null    ,
    MIDDLE_NAME     varchar(99)            null    ,
    SUFFIX_NAME     varchar(16)            null    ,
    COMPANY         varchar(255)           null    ,
    constraint Visitor_PK primary key (VISITORID)
)
go

/* ============================================================ */
/*   Index: LOGINID                                             */
/* ============================================================ */
create unique index LOGINID on Visitor (LOGINID)
go

/* ============================================================ */
/*   Table: RolePermission                                      */
/* ============================================================ */
create table RolePermission
(
    ROLEID          int                    not null,
    PERMISSIONID    int                    not null,
)
go

/* ============================================================ */
/*   Table: VisitorRole                                         */
/* ============================================================ */
create table VisitorRole
(
    VISITORID       int                    not null,
    ROLEID          int                    not null,
)
go

alter table RolePermission
    add constraint FK_ROLEPERM_REF_83_PERMISSI foreign key  (PERMISSIONID)
       references Permission (PERMISSIONID)
go

alter table RolePermission
    add constraint FK_ROLEPERM_REF_86_USERROLE foreign key  (ROLEID)
       references UserRole (ROLEID)
go

alter table VisitorRole
    add constraint FK_VISITORR_REF_89_USERROLE foreign key  (ROLEID)
       references UserRole (ROLEID)
go

alter table VisitorRole
    add constraint FK_VISITORR_REF_92_VISITOR foreign key  (VISITORID)
       references Visitor (VISITORID)
go



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to