Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6102123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:34:41+00:00 2026-05-23T13:34:41+00:00

My DB2 database is using UTF-8 encoding. The source table has one colum with

  • 0

My DB2 database is using UTF-8 encoding. The source table has one colum with UTF-8 text like these lines below

Greek: Μπορώ να φάω σπασμένα γυαλιά χωρίς να πάθω τίποτα
Czech: Mohu jíst sklo, neublíží mi
Serbian: Ја могу да једем стакло

My java code is doing this (.. snipped out irrelevant parts.. )

ResultSet rs = stmt.executeQuery("SELECT SAMPLE_TEXT FROM UNICODE_TEST");
File file = new File("Unicode.txt");
BufferedWriter outFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),"UTF8"));
while (rs.next()) {
    outFile.write(rs.getString("SAMPLE_TEXT"));
    outFile.write( "\n" );
}

The result in my file don’t look like those in the source table at all.
I get this instead

Greek: ΜποÏÏŽ να φάω σπασμένα γυαλιά χωÏίς να πάθω τίποτα
Czech : Mohu jíst sklo, neublíží mi
Serbian: Ја могу да једем Ñтакло

What did I miss?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:34:41+00:00Added an answer on May 23, 2026 at 1:34 pm

    Your Java code is ok. Are you sure you your file content is wrong? What you see can appear wrong if you have your terminal wrong, for example. Can you see ok other text files in that computer encoded as UTF-8? (If you are unsure, read it in hexa, get a dump with od, etc). If you are sure this is not your problem, then I’d point to some charset encoding setting in the JDBC connection (no experience with DB2).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to connect to a DB2 database, specifically an iSeries version, using
I'm running an SQL query against a mainframe DB2 database using the OdbcDataReader class
i'm trying to configure a datasource of an db2 database in tomcat (using eclipse
I'm using NHibernate to connect to an ERP database on our DB2 server. We
I am currently using Toad for DB2 to work on my DB2 database. I
I'm using Migrator.NET with a DB2 database and my current migration executes an ALTER
I need to copy a table from one database to another. This will be
A DB2 for z/OS database has been setup for me. Now I want to
I'm using a DB2 database and I'm hoping for a query which will iterate
Hey I'm trying to connect to a DB2 database, by using Servlets (Using NetBeans

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.