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
If this will not work, can you post more of your code ?
Best Regards,
Octav
--
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:c...@netinfo-moldova.com
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
Hello.
>From: muchan <muc...@promikra.si>
>Reply-To: muchan <muc...@promikra.si>
>To: inform...@iiug.org
>Subject: Re: Informix JDBC:sqli connection problem.
>Date: Fri, 08 Oct 1999 14:04:04 +0200
>
>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
>
Check this from the Informix JDBC Doc.
Software Dependencies
To use Informix JDBC Driver to connect to an Informix database, you must
use one of the following Informix database
servers:
Informix Dynamic Server, Version 7.x
Informix Dynamic Server, Workgroup and Developer Editions, Version
7.x
Informix Dynamic Server with Advanced Decision Support and
Extended Parallel Options, Version 8.x
Informix Dynamic Server with Universal Data Option, Version 9.x
INFORMIX-OnLine, Version 5.x
You must also use the following JavaSoft software:
Java Development Kit (JDK), Version 1.1.5 or later
So, if you're using SE, it won't connect. :-(
>
>
> > >
> > > 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
Angel Gomez
TelNor, S.A.
Tijuana, B.C., Mexico.
<Angel...@telnor.com>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Muchan
For SE, you need to specify the path to the database.dbs file in your JDBC URL.
Assume your database is contained in /data/database.dbs, then your URL would
look like this.
jdbc:informix-sqli://machine:port/ /data/database:INFORMIXSERVER=...
Note the space between machine:port/ and the path name. I had this problem too,
till someone on this list told me about this.
HTH
Sujit
muchan <muc...@promikra.si> on 10/08/99 05:04:04 AM
Please respond to muchan <muc...@promikra.si>
To: inform...@iiug.org
cc: (bcc: Sujit Pal)
Subject: Re: Informix JDBC:sqli connection problem.
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
> >
Angel
Yes it will. I am using SE 7.24 on Linux, JDK 1.1.6 on Linux and Informix JDBC
Driver 1.4. It works. You just need to change the JDBC URL slightly.
Sujit
Angel Gomez <an...@hotmail.com> on 10/08/99 07:35:58 AM
To: muc...@promikra.si, inform...@iiug.org
cc: (bcc: Sujit Pal)
Subject: Re: Informix JDBC:sqli connection problem.
Hello.
>From: muchan <muc...@promikra.si>
>Reply-To: muchan <muc...@promikra.si>
>To: inform...@iiug.org
>Subject: Re: Informix JDBC:sqli connection problem.
>Date: Fri, 08 Oct 1999 14:04:04 +0200
>
>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
>
Check this from the Informix JDBC Doc.
Software Dependencies
To use Informix JDBC Driver to connect to an Informix database, you must
use one of the following Informix database
servers:
Informix Dynamic Server, Version 7.x
Informix Dynamic Server, Workgroup and Developer Editions, Version
7.x
Informix Dynamic Server with Advanced Decision Support and
Extended Parallel Options, Version 8.x
Informix Dynamic Server with Universal Data Option, Version 9.x
INFORMIX-OnLine, Version 5.x
You must also use the following JavaSoft software:
Java Development Kit (JDK), Version 1.1.5 or later
So, if you're using SE, it won't connect. :-(
>
>
> > >
> > > 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
OK, OK...
You're right, i'm using Informix JDBC Driver 1.4 also, but the
documentation installed in the server is from an older release ( 1.22 and i
will update it), so... Yes it works with SE 5.X and 7.X.
So... how do you specify the URL ?
Thanks for everyone who helped me solving the problem.
With above URL, I could connect to SE server by "Direct Connection" method.
("Indirect Connection" method still fails, but I can live with one method.)
and thanks Andy for the tips
> catch (Exception e)
> {
> System.out.println(e.getErrorCode());
> System.out.println(e.getMessage());
> }
it seems
catch (SQLException e)
{
...
}
works better.
muchan