trying to connect gives :sun.io.CharToByteUTF-8 Exception

From: "Cristina Surroca" <cris(at)dmcid(dot)net>
To: <pgsql-jdbc(at)postgresql(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: trying to connect gives :sun.io.CharToByteUTF-8 Exception
Date: 2003-04-14 18:51:10
Message-ID: 001601c302b6$d2e71990$3031393e@cris
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

Hi,
I've working with postgreSQL and JDBC. I've made some proves and all has gone ok. But now, I've to do in other machine.
There is Postgresql 7.3.2, with ant. I've the in CLASSPATH the jar file.
But when I tried to run the code there is thrown a exception when it try to getConnection:

Something unusual has occured to cause the driver to fail. Please report this
exception: Exception: java.lang IllegalArgumentException: sun.io.CharToByteUTF-8 ...."

The thing it's that the same code works in other matchine, and I'm not able to find the error.
I've been looking for it, but I haven't got any result.

Does anybody know where is my fault?

Thanks a lot,

yours

Cris..

/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
import java.sql.*;

class CtrlDatMartes
{
private static Connection conn;

public boolean RealizarConexion() throws Exception
{
boolean conectat = false;
if(ActivacioDrivers())
{
try
{
conn = DriverManager.getConnection("jdbc:postgresql://localhost/cris","postgres","XXXX"); // <- Here my fault must be, but it should work, shouldn't it????
conectat = true;
}
catch(SQLException sqlex)
{
System.out.println("Cach");
System.out.println(sqlex.getErrorCode());
throw (new Exception(String.valueOf(sqlex.getMessage())));
}

}
return conectat;
}
private boolean ActivacioDrivers() throws Exception
{
boolean activat = false;

try
{
Class.forName("org.postgresql.Driver");
activat = true;
}
catch(ClassNotFoundException ex)
{
throw (new Exception("[???:] Error en l'activació dels DRIVERS."));
}
return activat;
}

}
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2003-04-14 18:56:09 Re: Need two languages in the database: Russian and English
Previous Message Jay O'Connor 2003-04-14 18:49:11 Re: MySQL and RHDB news; 8.0 troll

Browse pgsql-jdbc by date

  From Date Subject
Next Message Cristina Surroca 2003-04-14 20:53:55 Re: [sorry] trying to connect gives :sun.io.CharToByteUTF-8 Exception
Previous Message Daniel Serodio 2003-04-14 17:45:45 Re: JDBC x accent queries