I am trying to program a simple database application(nothing special, just something to help me learn) using JNDI to access the Datasource. Problem is I cant get it to work. I have installed J2SE 1.4 and just installed J2EE 1.4 Applications server.

The program:
__________________________________________________
package JNDI_JDBC_Test;

import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import java.util.*;
import java.io.*;


public class JDBC_test {

public static void main(String[] args) {

Connection con=null;

try{
// Create initial naming context
InitialContext ctx=new InitialContext( );

// get Datasource from the JNDI name server
DataSource ds=(DataSource) ctx.lookup("BeanzDB");

// get a connection from the DataSource
con = ds.getConnection();

Statement stmt=con.createStatement();
ResultSet rs = stmt.executeQuery("select * from BeanzDB");

while(rs.next()){
System.out.println("********************"+"\n"+"(1) "+rs.getString(0));
}

}
catch(SQLException e){
//display SQL specific exception information
System.out.println("*************************");
System.out.println("SQLException in main: "+e.getMessage());
System.out.println("** SQLState: "+e.getSQLState());
System.out.println("** SQL Error Code: "+e.getErrorCode());
System.out.println("*************************");
e.printStackTrace();
}
catch(NamingException e){
System.out.println("NamingException in main: "+e.getMessage());
}
catch(Exception e){
System.out.println("Exception in main: "+e.getMessage());
}
finally{
try{
// close connection
if (con != null)
con.close();
}
catch(SQLException e){
e.printStackTrace();
}
}
}
}
______________________________________________

My classPath = "E:\Programming\Java";"E:\Programming\SunONE;E:\Programming\Java\JNDI_JDBC_Test"; "E:\oracle\beanz\jdbc\lib\ojdbc14.jar"

The error it keeps coming back with is:
NamingException in main: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

I assume its something to do with my classpath??? but I cant understand what.

Do I have to have any sort of JNDI server running to use its services?

I am using a jndi.properties file located in the same directory as my application file. Its contents are:

java.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory
java.naming.provider.url=rmi://localhost:1099

Can anyone please explaine where Im going wrong????

Cheers
BarmyYeTTi