wood burning stoves 2.0*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Syntax Check and Connection failure" Watch "Syntax Check and Connection failure" New topic
Author

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>(IfxSqliConnect.java:950)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:243)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at CountAdult.main(CountAdult.java:27)

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.
Thanks,
Elton
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: http://aspose.com/file-tools
 
subject: Syntax Check and Connection failure