Connection pooling in java
От | janaka priyadarshana |
---|---|
Тема | Connection pooling in java |
Дата | |
Msg-id | [email protected] обсуждение исходный текст |
Ответы |
Re: Connection pooling in java
Re: Connection pooling in java |
Список | pgsql-jdbc |
hi all..
i am tring to use connection pool with postgresql..but it give an Exception when it is going to execute the line following. InitialContext().rebind("DataSource", source)
the cord is as follow.
Jdbc3PoolingDataSource source = new Jdbc3PoolingDataSource();
source.setDataSourceName("A Data Source");
source.setServerName("localhost");
source.setDatabaseName("mmsc");
source.setUser("janaka");
source.setPassword("1234");
source.setMaxConnections(10);
try {
new InitialContext().rebind("DataSource", source);
}
catch (NamingException ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}
the given exception is as follow....
javax.naming.NoInitialContextException : 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
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java :645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.rebind(InitialContext.java :367)
at MainClass.main(MainClass.java:29)
please help me to solve this..
--
...........Janaka Priyadarshana...........
i am tring to use connection pool with postgresql..but it give an Exception when it is going to execute the line following. InitialContext().rebind("DataSource", source)
the cord is as follow.
Jdbc3PoolingDataSource source = new Jdbc3PoolingDataSource();
source.setDataSourceName("A Data Source");
source.setServerName("localhost");
source.setDatabaseName("mmsc");
source.setUser("janaka");
source.setPassword("1234");
source.setMaxConnections(10);
try {
new InitialContext().rebind("DataSource", source);
}
catch (NamingException ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}
the given exception is as follow....
javax.naming.NoInitialContextException : 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
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java :645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.rebind(InitialContext.java :367)
at MainClass.main(MainClass.java:29)
please help me to solve this..
--
...........Janaka Priyadarshana...........
В списке pgsql-jdbc по дате отправления: