This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JForum and the fly likes Error in hottest topic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "Error in hottest topic" Watch "Error in hottest topic" New topic
Author

Error in hottest topic

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi,
I have some problems when I go to the page Hottest Topic in fact I receive this message:


An error has occurred.

For detailed error information, please see the HTML source code, and contact the forum Administrator.

java.sql.SQLException: Incorrect syntax near 'LIMIT'.


In the eclipse console I can read this error message:




I go to the class JForum to the line 210 and 217 (as it is mentioned by the error) and I find:



And I don't understand anything.

In the error it is said there is an error near LIMIT the query are conteined in generic_queries.sql
but I don't know what is the query used.

I suppose could be this:



But I don't find any errors.

Could someone help me?

Thanks, bye bye.





[originally posted on jforum.net by abdujaparov]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
It looks like you are using MSSQL for your DB Server. I believe that JForum 2.1.8 only supports SQL 2005. Mainly because this is the first version of SQL to have decent support for "limit" type statements (but not using LIMIT...), which jForum uses a lot of.

FWIW, you should be looking first in the mssql.sql file and then the generic.sql files. The mssql specific queries will be there.

FWIW, some people have found ways to modify the queries to support older versions of MS SQL. See the forums for this.

Also, if you don't mind using a slightly older version of jForum, see:

http://people.apache.org/gmonroe/jforum

This is a Torque based DAO (jforum data access layer) that I did for 2.1.6 that works with all MS SQL versions (we still have some V7 internal servers around... sigh)
[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hello,

I am facing the same trouble here.... FYI : I am getting this error even on SQL Server 2005

Monroe,

what exactly is your suggestion ? How do I change the queries to work

---------------

ERROR !! (happens when users click Hottest Topics)

--------------
An error has occurred.

For detailed error information, please see the HTML source code, and contact the forum Administrator.

java.sql.SQLException: Incorrect syntax near 'LIMIT'.


[originally posted on jforum.net by kallolb75]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
The fix is :

change the sqlserver.sql file for :

TopicModel.selectHottestTopicsByLimit = SELECT * \
FROM ( SELECT ROW_NUMBER() OVER (ORDER BY t.topic_views DESC) AS rownumber, \
t.*, p.user_id AS last_user_id, p.post_time, p.attach AS attach \
FROM jforum_topics t, jforum_posts p \
WHERE p.post_id = t.topic_last_post_id \
AND p.need_moderate = 0 ) AS tmp \
WHERE rownumber <= ?

and bingo !!
[originally posted on jforum.net by kallolb75]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi!

I found the same solution .
Thansk, bye bye.
[originally posted on jforum.net by abdujaparov]
 
 
subject: Error in hottest topic