[jboss-user] [JBoss Portal] - error while connecting to oracle db
vikas01
do-not-reply at jboss.com
Tue Apr 3 04:58:30 EDT 2007
this is my portal-oracle-ds.xml file
<local-tx-datasource>
<jndi-name>DatabaseConnection</jndi-name>
<connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>scott</user-name>
tiger
<min-pool-size>1</min-pool-size>
<max-pool-size>10</max-pool-size>
</local-tx-datasource>
i have stored this file in deploy directory
following is the java file which tries to acces the db
public class HelloVikas extends GenericPortlet
{
protected void doView(RenderRequest rRequest, RenderResponse rResponse)
throws IOException, PortletException
{
rResponse.setContentType("text/html");
PrintWriter out = rResponse.getWriter();
out.write("hello mr vikas nahar");
out.close();
try
{
System.out.println("connecting to database");
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("DatabaseConnection");
System.out.println("connected to.....................................");
}
catch (Exception e)
{
System.out.println(e);
}
}
};
and i get the following error:
javax.naming.NameNotFoundException: DatabaseConnection not bound
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033921#4033921
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033921
More information about the jboss-user
mailing list