Re: Informix JDBC:sqli connection problem.
Posted in 1999
Topics: Installation, Setup & Upgrades, Connectivity: ODBC / JDBC / .NET, Connectivity: ESQL/C, 4GL & Embedded SQL, Java & JDBC Development
Check again your CLASSPATH env variable. As I understand you are using some sort of jdk1.2.*. In this case try as an workaround (and for testing) to specify the classpath on comand line (-cp option) or put the ifxjdbc.jar file into your JREHOME/lib/ext directory. If this will not work, can you post more of your code ? Best Regards, Octav On Wed, Oct 06, 1999 at 04:51:02PM +0200, muchan wrote: > > I have experiences writing Informix Esql/C programs. This time I'm thinking to > immigrate to JDBC, and downloaded trial version of Informix JDBC driver 2.00. > > After installation, I had a difficulty connecting to the database. > The most simple program to test connection was demo/basic/DBConnection.java > > After managing to find to write correct argument, like > java DBConnection 'jdbc:informix-sqli://classic:1525:informixserver=classicnet; > user=muchan;passwd=pwd' > > I get: > ERROR: failed to load Informix JDBC driver. > ERROR: failed to connect! > Exception in thread "main" java.lang.NullPointerException > at DBConnection.main(Compiled Code) > > The code causing the error message is: > > try > { > Class.forName("com.informix.jdbc.IfxDriver"); > } > catch (Exception e) > { > System.out.println("ERROR: failed to load Informix JDBC driver."); > } > > I checked ClassPath, and there is "ifxjdbc.jar", which contains the class > "com.informix.jdbc.IfxDriver". So I suppose the class should be found and > loaded. > > Do I missing something? > > Thanks in advance. > > muchan -- Octav Chiriac Phone: (373) 2 22 99 67 NetInfo S.R.L. Fax: (373) 2 21 36 59 Chisinau (373) 2 22 84 88 Moldova, Republic of mailto:com@netinfo-moldova.com
I could solve the problem of loading JDBC driver, but connection to the database (on SE server on UNIX machine) never succeed... I always get Error message: ERROR: failed to connect! Exception in thread "main" java.lang.NullPointerException at DBConnection.main(Compiled Code) The code causing exception is: try { conn = DriverManager.getConnection(newUrl); } catch (SQLException e) { System.out.println("ERROR: failed to connect!"); } Can I trace down into DriverManager.getConnection() where the exception occurs? Does Informix gives source code for JDBC driver? Debugging tips appreciated. muchan > > > > After managing to find to write correct argument, like > > java DBConnection 'jdbc:informix-sqli://classic:1525:informixserver=classicnet; > > user=muchan;passwd=pwd' > > > > I get: > > ERROR: failed to load Informix JDBC driver. > > ERROR: failed to connect! > > Exception in thread "main" java.lang.NullPointerException > > at DBConnection.main(Compiled Code) > > > > The code causing the error message is: > > > > try > > { > > Class.forName("com.informix.jdbc.IfxDriver"); > > } > > catch (Exception e) > > { > > System.out.println("ERROR: failed to load Informix JDBC driver."); > > } > > > > I checked ClassPath, and there is "ifxjdbc.jar", which contains the class > > "com.informix.jdbc.IfxDriver". So I suppose the class should be found and > > loaded. > > > > Do I missing something? > > > > Thanks in advance. > > > > muchan