Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ClassNotFoundException with JDBC

831 views
Skip to first unread message

Jorge Cecílio

unread,
Dec 7, 2004, 1:00:52 PM12/7/04
to
Hi all

I'm having no "luck" trying my first-time connect to an I-SE server from a
Java application, using JDBC.


I'm always getting then error:
"Error: java.lang.ClassNotFoundException: com.informix.jdbc.IfxDriver"

I suspect the problem is in my CLASSPATH system variable, but I don't know
how to set it. Or, perhaps, the strings I'm using aren't correct.


Facts:
1) My network is "up and running";
2) Informix-SE is on a Unix remote machine;
3) My Java app is on Windows XP Home;
4) Informix Client-SDK 2.81 TC3 is installed on XP;
5) ODBC has no problems
(I've an MS-Access app that retrieves data from my SE server. My Java
app, with JDBC-ODBC bridge, also works fine);
6) Using Informix Client-SDK dbping, every connection are made successfully,
except... JDBC!;
7) In JDBC dbping tab, only "com.informix.jdbc.IfxDriver" seems to be the
right value since the other two options appears to be for db2
(COM.ibm.db2.jdbc.app.DB2Driver and COM.ibm.db2.jdbc.net.DB2Driver)
8) I'm trying protocol "jdbc:informix-sqli". The other option is "jdbc:db2"
(dbping);
9) My Java app:
try {
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //jdbc-odbc
bridge: works fine!
Class.forName("com.informix.jdbc.IfxDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}

try {
//String url = "jdbc:odbc:ifx_dsn"; //jdbc-odbc bridge: works
fine!
String url = "jdbc:informix-sqli"
Connection con = DriverManager.getConnection(url, "login",
"password");
Statement stmt = con.createStatement();
//retrieval of values
(...)
}
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}

On JDBC dbping tab is written "This Utility assumes that you have a JDBC
driver installed and a CLASSPATH set before running DBPING"
a) What do they mean by having a JDBC driver installed? Isn't this driver
installed when I installed Informix-SDK? If not, how can I get it?
b) Do I have to do something like I did to the ODBC driver (by creating and
configuring a
DSN)? Where and how?
c) I know CLASSPATH system variable isn't set. Should I set it in my system?
By what value? By a path within Informix-SDK folders? Should CLASSPATH be
set anywhere else (e.g. setnet32)?


I suspect the problem is in my CLASSPATH system variable, but I don't know
how to set it. Or, perhaps, the strings I'm using aren't correct.
Can Anyone help?

Thanks in advance,
Jorge Cecilio


jcr...@yahoo.com

unread,
Dec 7, 2004, 4:18:14 PM12/7/04
to

I have this enviroment

PATH=$PATH:/opt/java/java/bin
JDBCHOME=/opt/JDBC
CLASSPATH=.:/opt/java/java
ENVSEP=":"
CLASSPATH="$JDBCHOME/lib/xerces.jar$ENVSEP$CLASSPATH"
CLASSPATH="$JDBCHOME/lib/ifxlsupp.jar$ENVSEP$CLASSPATH"
CLASSPATH="$JDBCHOME/lib/ifxtools.jar$ENVSEP$CLASSPATH"
CLASSPATH="$JDBCHOME/lib/ifxlang.jar$ENVSEP$CLASSPATH"
CLASSPATH="$JDBCHOME/lib/ifxsqlj.jar$ENVSEP$CLASSPATH"
CLASSPATH="$JDBCHOME/lib/ifxjdbcx.jar$ENVSEP$CLASSPATH"
CLASSPATH="$JDBCHOME/lib/ifxjdbc.jar$ENVSEP$CLASSPATH"
export ENVSEP JDBCHOME CLASSPATH PATH

and java works fine


In the programa i use :


String new_url =
"jdbc:informix-sqli://<hostname>:<port>:informixserver=<informixserver>2;user=xxxxx;password=xxxx;fet_buf_size=128000";


__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
sending to informix-list

Fernando Nunes

unread,
Dec 9, 2004, 12:45:19 PM12/9/04
to
>>On JDBC dbping tab is written "This Utility assumes
>>that you have a JDBC
>>driver installed and a CLASSPATH set before running
>>DBPING"
>>a) What do they mean by having a JDBC driver
>>installed? Isn't this driver
>>installed when I installed Informix-SDK? If not, how
>>can I get it?

No. The driver isn't included in the CSDK. You'll have to get it from
IBM and install it.

>>b) Do I have to do something like I did to the ODBC
>>driver (by creating and
>>configuring a
>>DSN)? Where and how?

No... the URL should have all the information needed.

>>c) I know CLASSPATH system variable isn't set.
>>Should I set it in my system?

Yes.

>>By what value? By a path within Informix-SDK
>>folders? Should CLASSPATH be

By a paht which includes de folder where you installed the JDBC driver.
The documentation of the JDBC driver includes information about this.

Now... for the URL where you can get the JDBC driver...
Let me search.... ;)

... well I can't get it... I keep getting proxy errors.
But go to :

http://ibm.com/software/data/informix and search for "informix jdbc
driver download"


>>Thanks in advance,
>>Jorge Cecilio

Regards/Cumprimentos.

Espero que resolva :)

Fernando Nunes

0 new messages