my dog learned polymorphism
The moose likes JDBC and Relational Databases and the fly likes Environment problem: ORA-01722: invalid number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Environment problem: ORA-01722: invalid number" Watch "Environment problem: ORA-01722: invalid number" New topic

Environment problem: ORA-01722: invalid number

Jose Hurtado

Joined: Mar 30, 2012
Posts: 1
I have problems executing a Java program. It’s running OK in my local environment but I get this error running the jar from a Linux Red Hat 64-bit server:

java.sql.SQLException: ORA-01722: invalid number

at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.ttc7.TTIoer.processError(
at oracle.jdbc.ttc7.Oall7.receive(

I run the same jar in another Linux Red Hat 32-bit server and it’s OK. The program is connecting to a database in another server. I tried to execute the jar in several JVM (Sun and jRockit) and several versions in both environments, and I keep getting the exception in the Linux Red Hat 64-bitserver. It’s running OK with both JVM in local and in Linux Red Hat 32-bit server.

1) My PC is a Win XP (x86) and I run the program with Eclipse.

2) Linux Server with Exception: redhat-4 (x64)
3) Linux Server OK: Red Hat Enterprise Linux AS release 4 (Nahant Update 5) (x86)

4) Data Base: Oracle 11gR2

Any idea?

Thank you in advance.
Martin Vajsar

Joined: Aug 22, 2010
Posts: 3732

Hi Jose, and welcome to the Ranch!

As you didn't post the actual code, it is really hard to say, but my bet is: you're using a simple Statement with literal values, instead of PreparedStatement and bind variables. The national language settings is different on Linux and the numeric format of literal is not valid there. Your code is therefore subject to SQL injection attacks and implicit conversion bugs.

Again, this is only a guess since you didn't provide the code, but this is the most probable cause. If this doesn't help, use the stack trace to locate statement being executed and show us that code.
I agree. Here's the link:
subject: Environment problem: ORA-01722: invalid number
It's not a secret anymore!