Обсуждение: JDBC: java.lang.ArrayIndexOutOfBoundsException: 256

Поиск
Список
Период
Сортировка

JDBC: java.lang.ArrayIndexOutOfBoundsException: 256

От
Mirko Zeibig
Дата:
Hello,
my system:
RedHat 7.0
postgresql 7.1 (CVS)
IBMJava2-SDK-1.3-1.1

After having set JAVA_HOME "ant" is working like a charm, now it will build
postgresql.jar and postgresql-example.jar. I noticed however that there is a
difference between the ant and the make built: whereas with ant the jar has
about 83kB, with "make jdbc2" it is about 180kB

If I now switch to src/interfaces/jdbc/jars and execute:

java -cp postgresql.jar:postgresql-examples.jar example.psql \
jdbc:postgresql:mirko mirko *****

or alternatively from src/interfaces/jdbc

java -cp postgresql.jar:jars/postgresql-examples.jar example.psql \
jdbc:postgresql:mirko mirko *****

I always get the following error:
[mirko@romulan jdbc]$ java -cp
postgresql.jar:postgresql-examples.jar example.psql
jdbc:postgresql:mirko mirko mirko
PostgreSQL psql example v6.3 rev 1

Connecting to Database URL = jdbc:postgresql:mirko
Exception caught.
Something unusual has occured to cause the driver to fail. Please report
this exception: java.lang.ArrayIndexOutOfBoundsException: 256
Something unusual has occured to cause the driver to fail. Please report
this exception: java.lang.ArrayIndexOutOfBoundsException: 256
        at java.lang.Throwable.<init>(Throwable.java:84)
        at java.lang.Exception.<init>(Exception.java:35)
        at java.sql.SQLException.<init>(SQLException.java:100)
        at org.postgresql.util.PSQLException.<init>(PSQLException.java:42)
        at org.postgresql.Driver.connect(Driver.java:127)
        at java.sql.DriverManager.getConnection(DriverManager.java:523)
        at java.sql.DriverManager.getConnection(DriverManager.java:183)
        at example.psql.<init>(psql.java:31)
        at example.psql.main(psql.java:207)


PostgreSQL is accessible by unix-sockets and tcp/ip, I have no problems
connecting via psql, python or php.

I read the source of Driver.connect as well and found a description to
connect via jdbc:org.postgresql:mirko, which did result in a driver not
found error.

TIA

Mirko

Re: [JDBC] JDBC: java.lang.ArrayIndexOutOfBoundsException: 256

От
Peter T Mount
Дата:
Quoting Mirko Zeibig <mirko@picard.inka.de>:

Redirecting to the jdbc only list as that's where all jdbc emails should now go.

> Hello,
> my system:
> RedHat 7.0
> postgresql 7.1 (CVS)
> IBMJava2-SDK-1.3-1.1
>
> After having set JAVA_HOME "ant" is working like a charm, now it will
> build
> postgresql.jar and postgresql-example.jar. I noticed however that there
> is a
> difference between the ant and the make built: whereas with ant the jar
> has
> about 83kB, with "make jdbc2" it is about 180kB

make had the -0 flag while ant doesn't so the 83k one is compressed.
Needs checking, but in the early days, .jar files could not be compressed. If
jdk1.2 and later are ok, this is a bonus. But I wonder how browsers and
jdk1.1.x handle them.

[snip]

> this exception: java.lang.ArrayIndexOutOfBoundsException: 256
>         at java.lang.Throwable.<init>(Throwable.java:84)
>         at java.lang.Exception.<init>(Exception.java:35)
>         at java.sql.SQLException.<init>(SQLException.java:100)
>         at
> org.postgresql.util.PSQLException.<init>(PSQLException.java:42)
>         at org.postgresql.Driver.connect(Driver.java:127)
>         at java.sql.DriverManager.getConnection(DriverManager.java:523)
>         at java.sql.DriverManager.getConnection(DriverManager.java:183)
>         at example.psql.<init>(psql.java:31)
>         at example.psql.main(psql.java:207)

Thanks. There is a bug recently introduced in Driver & PSQLException. I added
the fuller stack trace this morning to try to find it. This will prove useful.

Peter

--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/