Author |
Message
|
DTran |
Posted: Mon Feb 02, 2009 4:26 am Post subject: An unrecognized CHARSET property was specified: ISO-8859-1 |
|
|
 Acolyte
Joined: 11 May 2006 Posts: 62 Location: Amsterdam
|
Hi,
I am facing a problem. We have the broker running on Z/os and using JavaComputeNode to get messages of a Sybase running on Unix. In the flow I use JDBC with stored procedure to access Sybase. This is part of the coding:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.ListResourceBundle;
import java.util.Properties;
import com.ibm.broker.javacompute.MbJavaComputeNode;
import com.ibm.broker.plugin.MbDate;
import com.ibm.broker.plugin.MbElement;
import com.ibm.broker.plugin.MbException;
import com.ibm.broker.plugin.MbMessage;
import com.ibm.broker.plugin.MbMessageAssembly;
import com.ibm.broker.plugin.MbOutputTerminal;
import com.ibm.broker.plugin.MbUserException;
import com.ibm.broker.plugin.MbXPath;
public class OphalenUitstelIBS_JavaCompute extends MbJavaComputeNode {
private static final String JAAR =
"jaar";
/* (non-Javadoc)
* @see
com.ibm.broker.javacompute.MbJavaComputeNode#evaluate(com.ibm.broker.plugin.MbMessageAssembly)
*/
public void evaluate(MbMessageAssembly contact admin) throws MbException
{
String methodName = "evaluate";
// haal de user defined properties op
String IBS_QUERY =
(String)getUserDefinedAttribute("IBS_QUERY");
String IBS_CONNECTION_STRING =
(String)getUserDefinedAttribute("IBS_CONNECTION_STRING");
String JDBC_KLASSE =
(String)getUserDefinedAttribute("JDBC_KLASSE");
String USER =
(String)getUserDefinedAttribute("USER");
String PASS =
(String)getUserDefinedAttribute("PASS");
String LOG_USER = "USER"; // het userid
dat gelogged zal worden in de stored procedure
// vooralsnog is dit 'USER', in de nabije
// toekomst krijgen we dit userid in het request mee
// call naar IBS faalt omdat IBS charSet
ISO-8859-1 gebruikt terwijl Broker ebcidic verstuurt.
// zet user en pass onder property.
Properties props = new Properties();
props.put("user",USER);
props.put("password",PASS);
props.put("charSet","ISO-8859-1"); // file encoding is
ISO-8859-1
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");
MbMessage inMessage = contact admin.getMessage();
// create new message
MbMessage outMessage = new MbMessage();
MbMessageAssembly outAssembly = new MbMessageAssembly(
contact admin , outMessage);
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
Class.forName(JDBC_KLASSE);
//DT: aanroep naar IBS en doorgeven juiste codepage dmv
property
connection =
DriverManager.getConnection(IBS_CONNECTION_STRING, props);
statement = connection.prepareStatement(IBS_QUERY);
once i run this, I get the error:
EXCPT JZ0I5: An unrecognized CHARSET property was specified:
ISO-8859-1.,com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
Could some one tell me what i have done wrong here?
Thx in advance
Tran _________________ There are 10 types of people in this world - those who understand binary and those who don't |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 02, 2009 4:36 am Post subject: Re: An unrecognized CHARSET property was specified: ISO-8859 |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
DTran wrote: |
once i run this, I get the error:
EXCPT JZ0I5: An unrecognized CHARSET property was specified:
ISO-8859-1.,com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
Could some one tell me what i have done wrong here?
|
Ok, for those of us with no Java (like me), how is this supposed to deal with the fact that the z/OS is using EBCDIC & the Unix is using ASCII?  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Feb 02, 2009 4:42 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Does Sybase even understand the "charset" property you are passing along in the jdbc string? As this is JDBC why not let it all sort itself out? Java knows string manipulations quite well.
It looks to me like what you are doing is not quite what would be expected.
If it were on a Unix platform, I'd say you need to set the environment language variable to be the same as ccsid 819 (ISO-8859-1) but you are comming from a zOS platform using java... you could probably pass on the charset id setting... although you should make sure the content of your DB query is in ccsid 819... To ensure that look at java.nio classes that will allow you to translate from on ccsid to the other...
And remember the broker's internals are in unicode (ccsid 1200).
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
DTran |
Posted: Mon Feb 02, 2009 4:54 am Post subject: |
|
|
 Acolyte
Joined: 11 May 2006 Posts: 62 Location: Amsterdam
|
I did test without the charSet, and the username is corrupted (strange characters).
Because i haven't use the JavaComputeNode before and also no Java knowledge at all, so i search the internet
What i have defined in the Properties are the same what i have found on the internet. But it didn't resolve my problem so I was hoping you guys can tell me more
I will search for the class java.nio. Thx for answer though _________________ There are 10 types of people in this world - those who understand binary and those who don't |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Feb 02, 2009 1:17 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
DTran wrote: |
I did test without the charSet, and the username is corrupted (strange characters).
Because i haven't use the JavaComputeNode before and also no Java knowledge at all, so i search the internet
What i have defined in the Properties are the same what i have found on the internet. But it didn't resolve my problem so I was hoping you guys can tell me more
I will search for the class java.nio. Thx for answer though |
you need to look at the classes in the package java.nio !  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rekarm01 |
Posted: Mon Feb 02, 2009 1:34 pm Post subject: Re: An unrecognized CHARSET property was specified: ISO-8859 |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
DTran wrote: |
EXCPT JZ0I5: An unrecognized CHARSET property was specified: ISO-8859-1.,com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source) |
From Google: http://download.sybase.com/pdfdocs/jcg0400e/jcrg.pdf
Quote: |
CHARSET Specifies the character set for strings passed through TDS. If you specify a charset, it must match a charset listed in syscharsets.
...
To determine which character sets are installed on your Adaptive Server, issue the following SQL query on your server to see a list of installed character sets:
Code: |
select name from syscharsets
go |
|
|
|
Back to top |
|
 |
DTran |
Posted: Tue Feb 03, 2009 12:25 am Post subject: |
|
|
 Acolyte
Joined: 11 May 2006 Posts: 62 Location: Amsterdam
|
thnx rekarm01,
I have asked the Sybase administrator.. he give me a list of supported charset... and the ISO-8859-1 is not on the list. Well it named iso_1 but it is the same. So i will change the code to iso_1 and try it again...
thx you all.
Grz,
Tran  _________________ There are 10 types of people in this world - those who understand binary and those who don't |
|
Back to top |
|
 |
|