Subject Tomcat +Firebird 1.5.3 + Jaybird - Order by clause error
Author catalin.florean

I am migrating my web application from Interbase 6.0.1 (linux) to
Firebird 1.5.3 (linux).
I am using Tomcat with the Jaybird JDBC driver.

With Interbase everything works ok.

I my servlet I have the following code:


public void init(ServletConfig conf) throws ServletException {
try {
Context ctx = new InitialContext();
ds = (DataSource)ctx.lookup("java:comp/env/jdbc/dbcorpvs");
conn = ds.getConnection();
catch (Exception e){


public void doPost(HttpServletRequest request, HttpServletResponse
throws IOException, ServletException


String strSelect="select TL.codact, TA.DenAct, tl.NRACT,
cast(tl.DATAACT as date) dataact, tl.rez, tp.denpub, tl.nrpub, "+
"cast(tl.datapub as date) datapub, te.denemitent FROM tlegi tl, TAct
Ta, Temitent TE, Tpub Tp "+
"where TL.tipact=TA.TipAct and tl.tippub=tp.tippub and
tl.tipemitent=te.tipemitent order by tl.tipact";


java.sql.PreparedStatement stmtSelect = null;
java.sql.ResultSet rsSelect = null;
try {
stmtSelect = conn.prepareStatement(strSelect);
rsSelect = stmtSelect.executeQuery();


When the query is executed I get the following error:

GDS Exception. 335544569. Dynamic SQL Error SQL error code = -104
Invalid expression in the ORDER BY clause (not contained in either an
aggregate function or the GROUP BY clause)

Without the order by clause in the sql string it is executed ok.

I also tried to change the query using the INNER JOIN table_b on
table_a.column = table_b.column sql syntax with the same results.

Note: When I execute the query from the IB Colsole, EMS QuickDesk or
Minq DBVisualiser (using the same Jaybird JDBC driver) it is executed
with no problem.

Any suggestions?


Catalin Florean