• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Syntax Check and Connection failure

 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic