I did a search and found a few other who have come across this problem and also resolved it. However they had access to the database itself and I don't.
I have a DB2 machine that was set up by the DB2 team at my work and it's working fine for them for a long time. Now I have a new computer on the network and I'm trying to write a Java application that will connect to the database and pull a few records from the tables. I have set up NOTHING but I was under the impression I didn't have to. As long as I give the correct parameters, I thought it would just connect. Is this right?
So far I have copied the JDBC drivers to the /Program Files/Java/jre1.6.0_03/lib/ext/ folder and written a simple application which will use them to connect to the database but I get this error:
Quote:
|
com.ibm.db2.jcc.c.SqlException: SQL1031N The database directory cannot be found on the indicated file system. SQLSTATE=58031
|
And here is the code I wrote, it's very simple:
Quote:
import java.sql.*;
/**
* @author Daniel Maher
*
*/
public class db2Test
{
/**
* @param args
*/
public static void main(String[] args)
{
// Load JDBC driver.
try
{
Class.forName("COM.ibm.db2os390.sqlj.jdbc.DB2SQLJD river");
String databaseUsername = "*******";
String databasePassword = "********";
String databaseURL = "jdbc:db2:devbdw";
Connection conn = DriverManager.getConnection(databaseURL, databaseUsername, databasePassword);
conn.close() ;
}
catch (Exception e)
{
System.err.println("Got an exception: " + e);
}
}
}
|
From my research on the error, it's telling me my URL is incorrect and it can't find the database I'm looking for. But I got the username/password/URL from the DB2 team and they say they're using them currently. Any ideas at all? I'm stumped.