Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / February 2005

Tip: Looking for answers? Try searching our database.

Java & MySQL show table status command

Thread view: 
400PM - 17 Feb 2005 22:16 GMT
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....! :)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.