History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: UP-1155
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Elliot Metsger
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
uPortal

o.j.p.layout.dlm.RDBMDistributedLayoutStore not happy with Microsoft MS-SQL server

Created: 11/Jul/05 02:24 PM   Updated: 09/May/06 01:50 PM
Component/s: Distributed Layout Management (DLM)
Affects Version/s: 2.5.1 RC1, 2.5.0 GA, 2.5.1 RC2, 2.5.2 RC1, 2.5.1 RC3, 2.5.1 GA, 2.5.2 GA
Fix Version/s: 2.5.4

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: 1. Text File up-1155.txt (3 kb)

Environment: CVS snapshot of rel-2-5-patches. Microsoft SQL (MS-SQL) Database Server. Tomcat 5.5.4. Sun Java 1.5.0-b64. MS Windows 2003 Standard Edition SP1.
Issue Links:
Generic Relation
This issue relates to:
UP-1128 RDBMServices metadata getting wrong d... Major Closed
 


 Description  « Hide
SQL executed by DLM doesn't seem to be MS-SQL friendly:

java.lang.RuntimeException: Anomaly occurred while loading structure or theme stylesheet user preferences for fragment 'Entertainment'. The fragment will not be available for inclusion into user layouts.
        at org.jasig.portal.layout.dlm.FragmentActivator.loadPreferences(FragmentActivator.java:357)
        at org.jasig.portal.layout.dlm.FragmentActivator.activateFragments(FragmentActivator.java:118)
        at org.jasig.portal.layout.dlm.RDBMDistributedLayoutStore$1.run(RDBMDistributedLayoutStore.java:175)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The column prefix 'ULS' does not match with a table name or alias name used in the query.
        at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
        at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Unknown Source)
        at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown Source)
        at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
        at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
        at com.microsoft.jdbc.base.BaseStatement.executeQuery(Unknown Source)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
        at org.jasig.portal.layout.dlm.RDBMDistributedLayoutStore._getStructureStylesheetUserPreferences(RDBMDistributedLayoutStore.java:1034)
        at org.jasig.portal.layout.dlm.RDBMDistributedLayoutStore.getDistributedSSUP(RDBMDistributedLayoutStore.java:841)
        at org.jasig.portal.layout.dlm.FragmentActivator.loadPreferences(FragmentActivator.java:350)
        ... 2 more

The suspect query is:
SELECT
        PARAM_NAME,
        PARAM_VAL,
        PARAM_TYPE,
        ULS.STRUCT_ID,
        CHAN_ID,
        ULP.STRUCT_PARM_NM,
        ULP.STRUCT_PARM_VAL
FROM UP_LAYOUT_STRUCT ULS, UP_SS_USER_ATTS UUSA
LEFT OUTER JOIN UP_LAYOUT_PARAM ULP ON UUSA.STRUCT_ID = ULP.STRUCT_ID
        AND UUSA.USER_ID=4
        AND UUSA.USER_ID = ULP.USER_ID
        AND PROFILE_ID=1
        AND SS_ID=4
        AND SS_TYPE=1
        AND UUSA.STRUCT_ID = ULS.STRUCT_ID
        AND UUSA.USER_ID = ULS.USER_ID
        AND UUSA.USER_ID = ULP.USER_ID

Focusing on this part of the above stack trace: "The column prefix 'ULS' does not match with a table name or alias name used in the query.", we attempted the following query on the database (directly, not through JDBC) which unaliases all of the references:

SELECT

UP_SS_USER_ATTS.PARAM_NAME,

UP_SS_USER_ATTS.PARAM_VAL,

UP_SS_USER_ATTS.PARAM_TYPE,

UP_LAYOUT_STRUCT.STRUCT_ID,

UP_LAYOUT_STRUCT.CHAN_ID,

UP_LAYOUT_PARAM.STRUCT_PARM_NM,

UP_LAYOUT_PARAM.STRUCT_PARM_VAL

FROM UP_LAYOUT_STRUCT, UP_SS_USER_ATTS

LEFT OUTER JOIN UP_LAYOUT_PARAM ON UP_SS_USER_ATTS.STRUCT_ID = UP_LAYOUT_PARAM.STRUCT_ID

AND UP_SS_USER_ATTS.USER_ID=4

AND UP_SS_USER_ATTS.USER_ID = UP_LAYOUT_PARAM.USER_ID

AND UP_SS_USER_ATTS.SPROFILE_ID=1

AND UP_SS_USER_ATTS.SS_ID=4

AND UP_SS_USER_ATTS.SS_TYPE=1

AND UP_SS_USER_ATTS.STRUCT_ID = UP_LAYOUT_STRUCT.STRUCT_ID

AND UP_SS_USER_ATTS.USER_ID = UP_LAYOUT_STRUCT.USER_ID

AND UP_SS_USER_ATTS.USER_ID = UP_LAYOUT_PARAM.USER_ID

However, this didn't seem to resolve the issue, we receive the message:
Server: Msg 107, Level 16, State 3, Line 1
The column prefix 'UP_LAYOUT_STRUCT' does not match with a table name or alias name used in the query.

The UP_LAYOUT_STRUCT table is present in our database (we can select rows out of it, etc.)

Also, some output from DatabaseMetaDataImpl:
INFO [http-8080-Processor25] rdbm.DatabaseMetaDataImpl.[] Jul/11 10:54:14 - Using join test: org.jasig.portal.rdbm.DatabaseMetaDataImpl$JdbcDb
 INFO [http-8080-Processor25] rdbm.DatabaseMetaDataImpl.[] Jul/11 10:54:14 - Microsoft SQL Server (Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
        Dec 17 2002 14:22:05
        Copyright (c) 1988-2003 Microsoft Corporation
        Enterprise Edition on Windows NT 5.2 (Build 3790: )
) / SQLServer (2.2.0040) database/driver
    Connected To: jdbc:microsoft:sqlserver://jhedev.nts.jhu.edu:1433;NETADDRESS=000000000000;HOSTPROCESS=0;SENDSTRINGPARAMETERSASUNICODE=true;LOGINTIMEOUT=0;DATABASENAME=uPortal;PROGRAMNAME=;SELECTMETHOD=cursor;WSID=
    Supports:
        Prepared Statements: true
        Outer Joins: true
        Transactions: true
        {ts metasyntax: true
        TO_DATE(): false

 All   Comments   Work Log   Change History      Sort Order:
Elliot Metsger [11/Jul/05 02:37 PM]
The original query:
SELECT
PARAM_NAME,
PARAM_VAL,
PARAM_TYPE,
ULS.STRUCT_ID,
CHAN_ID,
ULP.STRUCT_PARM_NM,
ULP.STRUCT_PARM_VAL
FROM UP_LAYOUT_STRUCT ULS, UP_SS_USER_ATTS UUSA
LEFT OUTER JOIN UP_LAYOUT_PARAM ULP ON UUSA.STRUCT_ID = ULP.STRUCT_ID
AND UUSA.USER_ID=4
AND UUSA.USER_ID = ULP.USER_ID
AND PROFILE_ID=1
AND SS_ID=4
AND SS_TYPE=1
AND UUSA.STRUCT_ID = ULS.STRUCT_ID
AND UUSA.USER_ID = ULS.USER_ID
AND UUSA.USER_ID = ULP.USER_ID

returns 5250 rows from my test mysql database. is that really intended?


Elliot Metsger [11/Jul/05 11:57 PM]
We fixed this issue by hacking RDBMDistributedLayoutStore.java. The PostgreSQL query seemed to work in place of the JDBC query. So we hard-coded the JDBC query to return the PostgreSQL query. (see attached patch). This seems to have worked for us but certainly this isn't a fool-proof patch - others ought to take a look.

Elliot Metsger [11/Jul/05 11:59 PM]
Ugly hack which hardcodes the postgres sql query in place of the jdbc query. Seems to work for our version of MS-SQL.