"SQLException: DB2 Driver error allocating environment handle, rc = -1"
Thanks in advance,
Tushar.
On Mon, 14 Aug 2000 18:51:28 +0100 esteemed mary did'st hold forth
thusly:
try
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
Connection c = DriverManager.getConnection("jdbc:db2:ukeygen","root","******");
}
catch(Exception e) { e.printStackTrace(); }
This ran from the scrapbook in VisualAge for Java. As I mentioned, if I start VAJ as root this code works but that obviously isn't a valid solution.
My install was pretty "vanilla". I took defaults to everything
I could.
-- Gary Murphy Hilbert Computing, Inc. 13632 S. Sycamore Dr. Olathe, KS 66062 913-780-5051
Do you get this problem if you use the net driver?
What that might tell you is whether it is not allowed to load the
db2java.zip vs not being allowed to access some file(s) in the app client
driver.
Also, do you have to actually connect as root? Or do you have to have
your current Linux login terminal session as root?
On Thu, 17 Aug 2000 09:30:56 -0500 esteemed Gary Murphy did'st hold forth
thusly:
>
The userid with which I connect to the database doesn't matter. In fact, "root" doesn't have any grant on any tables. I tried it again with the userid that does have access to the data (glm) and it fails the same way. It is failing on the driver load. I also checked to ensure that the failing userid (glm) has write access to /tmp in case DB2 is creating a FIFO or something. I do have write access to /tmp. I wonder if DB2 is creating a FIFO or something that only root has access to create. I am able to connect via the 'db2' CLI, so it must be something specific to the JDBC driver, not DB2 in general. I guess it could be execute access on the shared library (db2jdbc) or something like that. Let me check that. If I had the source code, I could likely figure it out myself. <Sigh>.
Thank you for the help.
-- Gary Murphy Hilbert Computing, Inc. 13632 S. Sycamore Dr. Olathe, KS 66062 913-780-5051
However, I can't see how that problem would happen only for a particular
user id.
Have you imported all the classes from db2java.zip into the VAJ IDE? If
so, have you added them to the path of your project? If you right click
on the particular class that you are starting you can bring up properties
for that class that include pathing info to use to run the class. You
might need to fix that to include the project that you've imported
db2java.zip into.
An alternative is to add db2java.zip to the path for external jar and zip
files for VAJ. I forget the place where that is done and don't have VAJ
running at the moment to check.
BTW, If you use the net driver then you need to go run db2jstrt (it
starts db2jd daemon that the net driver connects to) and specify a port
number and then use that same port number when you pass a URL to the net
driver. I think the details will be found in the Command Reference.
Here's another thought: You need to use the right version of the JDBC
drivers. In VAJ 3.0 unless you are using the EAE version you are running
on a JVM 1.1.x level. Well, it can't handle using the JDBC 2.0 drivers
for JVM 1.2.x and later.
You also might want to check the Problems tab of your work space to see
if you have errors in the imported db2java.zip (which you likely would
have if you imported the wrong one).
There is also news.software.ibm.com which has VAJ news groups. Someone
there might have a guess as to what you might be doing wrong.
On Thu, 17 Aug 2000 14:59:27 -0500 esteemed Gary Murphy did'st hold forth
thusly: