Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes SQLException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQLException" Watch "SQLException" New topic
Author

SQLException

Araujo Guntin
Greenhorn

Joined: Jan 06, 2003
Posts: 4
Hi ...
I downloaded Informix JDBC driver Type 4 and installed it already. I have written a small program
to test whether I could access to the Informix database using the driver.
I execute:
java getIfxMetaData 192.168.0.5 1533 maq website informix pass
where:
hosts = 192.168.0.5
port = 1533
dbname= maq
server= website
userid= informix
pass = pass
I got the error as below:-
ERROR: Attempt to connect to database server website failed.
java.sql.SQLException: Attempt to connect to database server website failed...
The Informix database server is located in the same machine as the JDBC Driver. No idea why this
is happening...will be most grateful if someone could help me out here.
Thank you
My codes are as below:-
Begin of code>>

[ Edited by Dave to format code ]
[ January 06, 2003: Message edited by: David O'Meara ]
Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
My first guess would be to check the URL for the JDBC connection: different DBs (and possibly different drivers) seem to require different formats, and I've gotten burned by this particular problem before.
Other ideas (in order of most probable to happen to me):
* the database service isn't running
* somehow I'm misparsing the incoming parameters to build my URL (I did cross-check that in your code: looks fine - but I'd probably still do a System.out to verify it)
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
Hey fellow Informix user...
Just in case you haven't seen the error explanation from Informix:
Attempt to connect to database server (servername) failed.
The program or application is trying to access another database server but has failed. Note the server name in the current statement.
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.
This message appears in Version 6.0 and later versions.

I ran your connection code (main()) against our ifx server and it worked fine.
As Tina suggested, verify that the db server is actually running and that you have the correct ip and port.
Have you tried connecting to it just through an sql editor?


Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
 
 
subject: SQLException
 
Similar Threads
Help! DriverManager.getConnection problem
Database not found ...
application move assistance
Informix and JDBC
Syntax Check and Connection failure