Hi,
I am using java to retrieve a resultset with "show table status" mysql
command. I am having problem reading the [name] and [engine] column.
In the metadata object it is showing as VARCHAR but when I do
getString() it is returning me the object string (e.g. "[B@1e3e7d2")and
not the actual database value. I am using Mysql 4.1 and jdbc driver
3.1. I tried getB/Clob, getBytes, getCharacterStream() and none of
them is working. Any assistance will be appreciated.
thank you in advance.....
Mark Matthews - 18 Feb 2005 00:22 GMT
> Hi,
>
[quoted text clipped - 7 lines]
>
> thank you in advance.....
400,
Are you sure you don't have an old version of the driver lying around in
the classpath (MySQL-4.1 sends some different metadata that would
confuse an old 3.0 or 2.0.14 version of the driver)...What does
Connection.getMetaData().getDriverVersion() return?
I just tested this with 3.1.6 and 4.1.9 with the following little
program and got this output:
Connection conn = DriverManager.getConnection("jdbc:mysql://:3308/test");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SHOW TABLE STATUS");
while (rs.next()) {
System.out.println(rs.getString("name") + "-> " +
rs.getString("engine"));
}
**** OUTPUT ****
CUSTOMER-> InnoDB
DATETEST-> MyISAM
PAIR-> InnoDB
TRAVERSAL-> MyISAM
Test-> MyISAM
Test2-> InnoDB
UPDATABLE-> MyISAM
[snip]
-Mark
400PM - 18 Feb 2005 01:20 GMT
Thank you mark. I will check my drive if any old drivers are lying
around.
400PM - 18 Feb 2005 01:26 GMT
Hey Mark,
What is your java package for MySQL driver. I'm using
com.mysql.jdbc.Driver but I also see org.gjt.mm.mysql.Driver.
The 3.1.6 driver docs says to use com.mysql....
400PM - 18 Feb 2005 01:36 GMT
Connection.getMetaData().getDriverVersion() is returning
mysql-connector-java-3.1.6. It still showing the same behavior. I am
using disconnected jdbc rowsets... I wonder if this is causing the
problem. Any experience with jdbc rowsets?
400PM - 18 Feb 2005 01:48 GMT
Mark,
It is the disconnected rowset that is having the problem. I am using
regular rs and it seems to work fine.
Thank you for you help....! :)