hi i am tring to use connection pooling in java with postgresql database.

in given examples, i cant understand these file names that is given to create
InitialContext object, also that file names are different for each and every examples.

how can i get those files, and what are those..?

// Set up environment for creating initial context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
env.put(Context.PROVIDER_URL, "file:c:\\JDBCDataSource");
Context ctx = new InitialContext(env);
// Register the data source to JNDI naming service
ctx.bind("jdbc/ConnectSparkyOracle", ds);

Recommended Answers

All 3 Replies

That's the JDBC driver for the database you're planning to talk to.
Read its documentation, it will tell you what to do.
The first is a classname (provided by the driver), the second looks to be the URI for the driver to talk to the actual database (in this case a simple directory on the local filesystem, not something you'd want for a production system).

Do read some basic JDBC tutorials and your driver documentation. It makes life so much easier.

i am using postgre sql 8.1 database sever.. so what should i use at those plases insted of existing

I wouldn't know, but the documentation for the JDBC driver you need will know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.