Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a TEXT field from the database

Status
Not open for further replies.

gladz

Programmer
Dec 30, 2002
1
CA
I am using a MySQL database and I have a field of datatype TEXT. I am programming in Java and I get my record set using a CachedRowSet object. I am trying to get the value of the field using the getString function but it's not working. Does the CachedRowSet not support the TEXT datatype? How can I get that field?

 
Hello !

I don't know for CachedRowSet, but this code works with TEXT fields of MySQL 3.23 + MyODBC + the bridge odbc-jdbc

Code:
      ResultSet rs = myPreparedStatement.executeQuery();
      int columnCount = rs.getMetaData().getColumnCount();
      while (rs.next()) {
        for(int i=1; i <= columnCount; i++) {
          String s = rs.getString(i);
        }
      }
      rs.close();
      myPreparedStatement.close();

I hope that info will help you.

Thomas ---
A free GUI for your database:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top