This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Syntax Check and Connection failure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Syntax Check and Connection failure" Watch "Syntax Check and Connection failure" New topic

Syntax Check and Connection failure

Elton Hughes
Ranch Hand

Joined: Jun 19, 2003
Posts: 72
Hello All,
I have downloaded and install the Informix JDBC driver, but I am having a bit of trouble. My class is compiling, but fails during execution. I believe the problem is in this section:

The error message is this:

FAILED: problem with getConnection method
com.informix.asf.IfxASFException: Attempt to connect to database server (on_sun) failed.
java.sql.SQLException: com.informix.asf.IfxASFException: Attempt to connect to database server (on_sun) failed.
at com.informix.jdbc.IfxSqliConnect.<init>(
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at com.informix.jdbc.IfxDriver.connect(
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at CountAdult.main(

It is all a bit beyond me. The code is a near copy out of the documentation. The variables I have supplied it, IP address, port number, server name, userid and password are all correct.
If you have thoughts, I would greatly appreciate hearing from you.
Jason Steele
Ranch Hand

Joined: Apr 25, 2003
Posts: 100
I don't see you registering the driver...
try to put Class.forName("your-driver-className-here") at the beginning of your try {} block. Since I am not familiar with the Informix connection string, I would also double-check the connection string just to be sure it is right.

Good Luck

An egg is a chicken's house!
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
Whenever I have received that error it has usually meant one of 3 things:
1. The INFORMIXSERVER var is not correct
2. The server is not running
3. You're unable to connect due to a network issue (e.g. you got dropped by a firewall, etc)
From the Informix error guide:
The desired database server is unavailable, or the network is down or is congested. Ask your DBA and system administrator to verify that the server and network are operational. If the network is congested, use the environment variables INFORMIXCONTIME and INFORMIXCONRETRY to tune connection timing. For information on setting these environment variables, see the Informix Guide to SQL: Reference

Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
I agree. Here's the link:
subject: Syntax Check and Connection failure
Similar Threads
SQL Server 2000 JDBC Driver Error
Why cant connect to another computer in lan?
informix connection to linux
Oracle 7 and JDBC
Problem with connecting to database