Bug#369379: libmysql-java: Left join and order
Luis Fernando Llana D�az
luis at antares.sip.ucm.es
Mon May 29 13:00:51 UTC 2006
Package: libmysql-java
Version: 3.1.11-1
Severity: important
I have succesfully been using mysql 4.1 with libmysql-java with
jdk 1.4 downloaded from sun site.
Last week I tried to migrate to mysql 5, in fact I do not know if the
bug is mysl 5 or in libmysl-java. The problem is the following, if I make
a query as follows
sql="select vales.fecha,obras.nombre from vales left join obras on vales.obra=obras.id ";
pstmt = con.prepareStatement(sql);
rs=pstmt.executeQuery();
rsmd = rs.getMetaData();
System.out.println(rsmd.getColumnName(2)+":"+rsmd.getTableName(2)+":");
rs.next();
System.out.println(rs.getString("obras.nombre"));
every thing is perfect, but if I try order the query by obras.nombre
sql="select vales.fecha,obras.nombre from vales left join obras on vales.obra=obras.id order by obras.nombre";
pstmt = con.prepareStatement(sql);
rs=pstmt.executeQuery();
rsmd = rs.getMetaData();
System.out.println(rsmd.getColumnName(2)+":"+rsmd.getTableName(2)+":");
rs.next();
System.out.println(rs.getString("obras.nombre")); <--- line 961
I get an exception at the last line:
Exception in thread "main" java.sql.SQLException: Column 'obras.nombre' not found.
at com.mysql.jdbc.ResultSet.findColumn(ResultSet.java:929)
at com.mysql.jdbc.ResultSet.getString(ResultSet.java:4977)
at valesRV.Vales.main(Vales.java:961)
in fact, if I print 'rsmd.getTableName(2)', that should be 'obras', it is the empty string.
As I said previously, I don't if the error is in libmysql-java
or in mysql server since that query in the mysql console works perfectly
and with mysql-server-4.1 I do not have any problems.
The version if mysql I have is:
ii mysql-server-5.0 5.0.21-3 mysql database server binaries
l
-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.15-1-686-smp
Locale: LANG=es_ES at euro, LC_CTYPE=es_ES at euro (charmap=ISO-8859-15)
Versions of packages libmysql-java depends on:
ii java1-runtime-dummy [java1-ru 1.0 Dummy package providing java1-runt
ii java2-runtime-dummy [java2-ru 1.0 Dummy package providing java2-runt
-- no debconf information
More information about the pkg-java-maintainers
mailing list