Oracle Invalid number ORA-01722

I stumbled upon a very brain-f**k error on Oracle 10g on these days.

Context: the following query

SELECT
  * 
 FROM
  (    
    SELECT
      TO_NUMBER(CUSTOMER_ID) AS SNDG
    FROM
      BAD_CODES_TABLE    WHERE    
    AND I_LIKE=UPPER('STATIC_CONDITION')
    AND CUSTOMER_ID NOT LIKE '%P%'
  )
  S
WHERE
  TO_NUMBER(S.SNDG) >2000

could trigger a Invalid number if CUSTOMER_ID column contains invalid numbers.

Why?

Well…if you ask to “explain plan”, you will get something like

  • a table full scan
    • Filter Predicates AND
      • I_LIKE=UPPER(‘STATIC_CONDITION’)
      • TO_NUMBER(S.SNDG) >2000
      • CUSTOMER_ID NOT LIKE ‘%P%’

Continue reading “Oracle Invalid number ORA-01722”

Java HttpClient and Load Balancer bad interactions

Working for a very big customer, I found a very nasty interaction between Sun HttpClient (JDK 1.4) and Http  Load Balancers.

In a complex network environment, sometimes you can experience low level TCP/IP comunication errors, because sometimes HttpClient get confused and hangs.

The bad behavior of Sun HttpClient is well known: some guys suggested me to use the Axis Web Client. Anyway you can solve the issue adding these three parameters to the JVM launch line

-Dsun.net.client.defaultConnectTimeout=5000
-Dsun.net.client.defaultReadTimeout=5000
-Dhttp.keepAlive=false

The first two parameters set globally the socket timeout to 5 seconds.
The last parameter forces the JVM to avoid reusing http connections when doing http request.

To be honest, http.keepAlive=false is not always effective and could have huge performance impacts, so be very carful adopting it.

But if you stick on the two sun.net.client.default*  properties (doing some tests) you can solve the issue.

References

From Java Plug-in Control Panel:

[…]
Networking properties description:

sun.net.client.defaultConnectTimeout

sun.net.client.defaultReadTimeout

These properties specify, respectively, the default connect and read timeout values for the protocol handlers used by java.net.URLConnection. The default values set by the protocol handlers is -1, which means there is no timeout set.

sun.net.client.defaultConnectTimeout specifies the timeout (in milliseconds) to establish the connection to the host. For example, for http connections it is the timeout when establishing the connection to the http server. For ftp connections it is the timeout when establishing the connection to ftp servers.

sun.net.client.defaultReadTimeout specifies the timeout (in milliseconds) when reading from an input stream when a connection is established to a resource.

For the official description of these properties, see Networking Properties.

[…]

Brasil4Win 1.1 and Jython 2.5a3: testing in progress

Because of the forthcoming release of Jython 2.5 (after an year of silence), we at Gioorgi.com are checking Brasil compatibility, right now.  What is Jython?… we read from the Jython website:

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

Jython 2.5 looks very promising, and we are planning Jython support for future Brasil releases.

Continue reading “Brasil4Win 1.1 and Jython 2.5a3: testing in progress”