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 547201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:56:53+00:00 2026-05-13T10:56:53+00:00

I have problem with JDBC application that uses MONEY data type. When I insert

  • 0

I have problem with JDBC application that uses MONEY data type.
When I insert into MONEY column:

insert into _money_test (amt) values ('123.45')

I got exception:

Character to numeric conversion error

The same SQL works from native Windows application using ODBC driver.
I live in Poland and have Polish locale and in my country comma separates
decimal part of number, so I tried:

insert into _money_test (amt) values ('123,45')

And it worked.
I checked that in PreparedStatement I must use dot separator: 123.45.
And of course I can use:

insert into _money_test (amt) values (123.45)

But some code is “general”, it imports data from csv file and it was safe to put number into string literal.

How to force JDBC to use DBMONEY (or simply dot) in literals?

My workstation is WinXP.
I have ODBC and JDBC Informix client in version 3.50 TC5/JC5.
I have set DBMONEY to just dot:

DBMONEY=.

EDIT:

Test code in Jython:

import sys
import traceback
from java.sql import DriverManager
from java.lang import Class

Class.forName("com.informix.jdbc.IfxDriver")

QUERY = "insert into _money_test (amt) values ('123.45')"

def test_money(driver, db_url, usr, passwd):
    try:
        print("\n\n%s\n--------------" % (driver))
        db = DriverManager.getConnection(db_url, usr, passwd)
        c = db.createStatement()
        c.execute("delete from _money_test")
        c.execute(QUERY)
        rs = c.executeQuery("select amt from _money_test")
        while (rs.next()):
            print('[%s]' % (rs.getString(1)))
        rs.close()
        c.close()
        db.close()
    except:
        print("there were errors!")
        s = traceback.format_exc()
        sys.stderr.write("%s\n" % (s))



print(QUERY)
test_money("com.informix.jdbc.IfxDriver", 'jdbc:informix-sqli://169.0.1.225:9088/test:informixserver=ol_225;DB_LOCALE=pl_PL.CP1250;CLIENT_LOCALE=pl_PL.CP1250;charSet=CP1250', 'informix', 'passwd')
test_money("sun.jdbc.odbc.JdbcOdbcDriver", 'jdbc:odbc:test', 'informix', 'passwd')

Results when I run money literal with dot and comma:

C:\db_examples>jython ifx_jdbc_money.py
insert into _money_test (amt) values ('123,45')


com.informix.jdbc.IfxDriver
--------------
[123.45]


sun.jdbc.odbc.JdbcOdbcDriver
--------------
there were errors!
Traceback (most recent call last):
    File "ifx_jdbc_money.py", line 16, in test_money
        c.execute(QUERY)
SQLException: java.sql.SQLException: [Informix][Informix ODBC Driver][Informix]Character to numeric conversion error


C:\db_examples>jython ifx_jdbc_money.py
insert into _money_test (amt) values ('123.45')


com.informix.jdbc.IfxDriver
--------------
there were errors!
Traceback (most recent call last):
    File "ifx_jdbc_money.py", line 16, in test_money
        c.execute(QUERY)
SQLException: java.sql.SQLException: Character to numeric conversion error



sun.jdbc.odbc.JdbcOdbcDriver
--------------
[123.45]
  • 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-13T10:56:54+00:00Added an answer on May 13, 2026 at 10:56 am

    I solved this problem by using PreparedStatement. I think that “Character to numeric conversion error” is a bug in Informix JDBC driver.

    In other database I often use, PostgreSQL, there is no difference if I run query via native JDBC driver or via JDBC-ODBC bridge. I found that PostgreSQL do not accept numeric form 123.45. PostgreSQL accepts string literal with dot, but this dot is handled as a thousand separator. The only correctly accepted value is string literal where comma separates decimal part.

    EDIT:

    It can be solved by setting DBMONEY=. on server side, then all connections (ODBC, JDBC) will work with that setting.

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

Sidebar

Ask A Question

Stats

  • Questions 311k
  • Answers 311k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer 1/ Should the baselines be created on the development branch… May 13, 2026 at 10:21 pm
  • Editorial Team
    Editorial Team added an answer Two choices: Counter File. Check the directory. Counter File. with… May 13, 2026 at 10:21 pm
  • Editorial Team
    Editorial Team added an answer Tango has a few simple functions for converting between ANSI… May 13, 2026 at 10:21 pm

Related Questions

I have a Java JDBC application that uses multiple threads to retrieve information from
My application uses JDBC database drivers. I load these from a jar file, db2jcc.jar
I'm having a bit of a problem with converting the result of a MySQL
I am new to creating Java web applications and came across this problem when
In my application, Spring manages connection pool for database access. Hibernate uses these connections

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.