Hello Mark,

Thanks for your help...

Since I have received your mail, I have made a few more tests. I took the part of the web application and made a short one.

The result is that I can repeat the problem with the databases that are generated by the web application, but if I use the database test generated by the installation, I can't reproduce the problem.

If I use 'describe CLIENT;' in mysql client, I can see the structure of the table and no exception message is displayed.

The web application generates the database and the tables using String queries that are executed in statements.

Is there a way to see what goes wrong in a database ?

I join you the part of the source code I use to repeat the problem and the two databases.

NGADMIN_DB is the database where I have the following exception on the table CLIENT.
Result :
Exception caught.
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1474)
at com.mysql.jdbc.DatabaseMetaData.getColumns(DatabaseMetaData.java:877)
at mysqltest.<init>(mysqltest.java:33)
at mysqltest.main(mysqltest.java:61)

test is the database where there is no problem (table : pet).
Result :
name name
name owner
name species
name sex
name birth
name death


Attachment: NGADMIN_DB.tar.gz
Description: GNU Zip compressed data

Attachment: test.tar.gz
Description: GNU Zip compressed data



the source code :

/*
 * Java sample program - mysqltest.java
 */

import java.io.*;
import java.sql.*;

public class mysqltest
{
   Connection  conn;                     // holds database connection
   Statement   stmt;                     // holds SQL statement

   // the table where the problem exists
   String _host = "goupix.bookmark.fr" ;
   String _database = "NGADMIN_DB" ;
   String _user = "usertest" ;
   String _password = "" ;

String _table = "CLIENT" ;


// the table where there is no problem /* String _host = "goupix.bookmark.fr" ; String _database = "test" ; String _user = "usertest" ; String _password = "" ;

   String _table = "pet" ;
        */

public mysqltest() throws ClassNotFoundException,
FileNotFoundException, IOException, SQLException
{
// load database interface
Class.forName("com.mysql.jdbc.Driver");
// connect to the database
conn = DriverManager.getConnection("jdbc:mysql://"+ _host + "/" + _database, _user, _password);

        DatabaseMetaData dmd = conn.getMetaData() ;
        ResultSet resultSet = dmd.getColumns( null, null, _table, null ) ;
        while ( resultSet.next() )
        {
                String name = resultSet.getString( 4 ) ;
                System.out.println ( "name " + name ) ;
        }
        resultSet.close() ;

        conn.close();
   }

   public static void main(String args[])
   {
     try {
       mysqltest test = new mysqltest();
     } catch(Exception exc)
     {
        System.err.println("Exception caught.\n" + exc);
        exc.printStackTrace();
     }
   }
}

Thierry Boucheny


Thierry Boucheny wrote:

>> Hello,
>>
>> I am working on a web application using tomcat 4.1 & j2sdk 1.4.1 on Red
>> Hat 7.2. This app get the following error in a request to a database on
>> MySql server 4.1.
>>
>> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>> at java.lang.String.substring(String.java:1474)
>> at
>> com.mysql.jdbc.DatabaseMetaData.getColumns(DatabaseMetaData.java:877)
>>
>> I use Jconnector 3.0.8 as the JDBC driver.
>>
>> I have seen that others had this problem but I could not see if it was
>> solved or not.
>>
>> Thanks for any help.
>>
>> Thierry Boucheny
>>
>>

>Hi!
>
>Do you have a repeatable test case I could use? The JDBC driver runs
>through the JDBC compliance test as well as some internal regression and
>unit tests which actually call this method in DatabaseMetadata, and it
>doesn't fail, so it is probably something specific to your particular usage.

>Thanks!

> -Mark


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to