Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    6

    Unanswered: How to retrieve DB encoding as generically as possible?

    Hi,

    is there a way to determine the encoding (e.g UTF-8) a database was created with via JDBC? The goal is to determine that the database encoding is UTF-8 but it needs to be operable with as many DBMS as possible.

    If not is there a way to get this info from DB2 only?

    thanks in advance.

  2. #2
    Join Date
    Jan 2004
    Location
    Somewhere on the 3rd planet.
    Posts
    13
    Hi.
    Usually to get the database metadata they use the method

    DatabaseMetaData Connection :: getMetaData()

    after connecting to a database.

    But none of the DatabaseMetaData class methods serves for getting the database locale info.
    You can read about these classes here:
    http://java.sun.com/j2se/1.3/docs/ap...onnection.html
    http://java.sun.com/j2se/1.3/docs/ap...eMetaData.html

    As far as I can see, the best way would be SELECT'ing locale info from database system catalog table, as it can be done with InterBase or Informix.

    Hope, I've been of some help.
    Best regards,
    WGM

  3. #3
    Join Date
    Jan 2004
    Location
    Somewhere on the 3rd planet.
    Posts
    13
    P.S. In order to select from database system catalog table one should connect with sufficient access rights. And, surely, one should know the names of those tables.
    Best regards,
    WGM

  4. #4
    Join Date
    Jan 2004
    Posts
    6
    okay thanks, that is what we decided to do. It's not as flexible as we would like but it will do, we will just need to customise based on dbms used for app persistency.

    thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •