I have a Java Application running on Windows 2000.
Initially it accessed an Access database, and now that I have installed
postgreSQL, I want to configure it to access postgreSQL.
Is there a single document that can take me through the steps, or can
someone give me a simple checklist of what I need to do?????
I have downloaded the JDBC driver and I know:
- the driver class exists at "C:\Program Files\PostgreSQL\8.0\jdbc";
- it is in a JAR file ( I unpacked the JAR file, only to realise I didn't
need to )
However my code throws a ClassNotFound exception.
Below is some code I wrote to test and set property values, and to check
whether the driver directory and driver.class exist.
public void displayClasspath()
{
String driverPath = "C:\\Program Files\\PostgreSQL\\8.0\\jdbc";
String classpath = System.getProperty("java.class.path");
_displayTextArea.append("Classpath = " + classpath + "\n");
classpath = classpath + ";" + driverPath;
System.setProperty("java.class.path", classpath);
_displayTextArea.append("Classpath = " + classpath + "\n");
System.setProperty("jdbc.drivers", driverPath);
String drivers = System.getProperty("jdbc.drivers");
_displayTextArea.append("Drivers = " + drivers + "\n");
try
{
File driverDir = new File(driverPath);
if ( driverDir.isDirectory() )
_displayTextArea.append("DriverDir is a directory \n");
else
_displayTextArea.append("DriverDir is NOT a directory \n");
File dFile = new File(driverPath + "\\org\\postgresql\\Driver.class");
if ( dFile.isFile() )
_displayTextArea.append("Driver is a file \n");
else
_displayTextArea.append("Driver is NOT a file \n");
String driver = "org.postgresql.Driver";
driverPath = driverPath + "\\" + driver;
Class.forName(driverPath);
}
catch (ClassNotFoundException cnfe)
{
System.out.println("ClassNotFoundException.");
}
}
This code produces these messages:
Classpath = C:\Eclipse\Workspace\Test
Classpath = C:\Eclipse\Workspace\Test;C:\Program Files\PostgreSQL\8.0\jdbc
Drivers = C:\Program Files\PostgreSQL\8.0\jdbc
DriverDir is a directory
Driver is a file
Yet whether I use:
Class.forName(driverPath)
OR
Class.forName(driver)
it throws a ClassNotFoundException
I believe the Postmaster needs to be started with a �-I� option to enable
TCP/IP communication between application and server.
However it appears that the Postmaster is started in the boot sequence
somewhere, and I don�t know where I need to make this adjustment.
I would appreciate your help.
Yours sincerely
Peter Cook
_________________________________________________________________
Sell your car for $9 on carpoint.com.au
http://www.carpoint.com.au/sellyourcar