aspose file tools*
The moose likes JBoss/WildFly and the fly likes wht Jboss settings need to be done to get DB connection using JNDI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "wht Jboss settings need to be done to get DB connection using JNDI" Watch "wht Jboss settings need to be done to get DB connection using JNDI" New topic
Author

wht Jboss settings need to be done to get DB connection using JNDI

Shiney Thomas
Greenhorn

Joined: Jul 16, 2007
Posts: 3
Hii All

I am totally new in doing the Configuration of Jboss.
I am using PostGreSQL 8.1 Databse
JBoss-4.2.0 is my Application Server.

I am not able to get connection using JNDI naming convention.
Can anybody pls help me .

Thanks in Advance.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10263
    
168

Hello "Shiney Baby"

Welcome to JavaRanch

We are glad to have you here. We have a naming policy at JavaRanch. Your displayed name must consist of a first name (or an initial), a space, and a family name (in that order) and not be obviously fictitious. Please take a moment to change it, which you can do right here.


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10263
    
168

Have you setup a datasource for PostgreSQL as mentioned at SetUpAPostgreSQLDatasource. How are you accessing the datasource? Can you post the code? Also, do you see any exceptions when you try to access the datasource? If so, please post the exception stacktrace.
Shiney Thomas
Greenhorn

Joined: Jul 16, 2007
Posts: 3
Originally posted by Jaikiran Pai:
Have you setup a datasource for PostgreSQL as mentioned at SetUpAPostgreSQLDatasource. How are you accessing the datasource? Can you post the code? Also, do you see any exceptions when you try to access the datasource? If so, please post the exception stacktrace.


Hii!

While taking connection , it is not throwing any error.

the contents of Postgre-ds.xml are............

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: postgres-ds.xml 41016 2006-02-07 14:23:00Z acoliver $ -->
<!-- ==================================================================== -->
<!-- Datasource config for Postgres -->
<!-- ==================================================================== -->


<datasources>
<local-tx-datasource>
<jndi-name>PostgresDS</jndi-name>
<connection-url>jdbc ostgresql://192....:5432/9thJuly2007</connection-url>;
<driver-class>org.postgresql.Driver</driver-class>
<user-name>xx</user-name>
<password>yy</password>
<!-- sql to call when connection is created. Can be anything, select 1 is valid for PostgreSQL
<new-connection-sql>select 1</new-connection-sql>
-->

<!-- sql to call on an existing pooled connection when it is obtained from pool. Can be anything, select 1 is valid for PostgreSQL
<check-valid-connection-sql>select 1</check-valid-connection-sql>
-->

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>PostgreSQL 8.1</type-mapping>
</metadata>
</local-tx-datasource>

</datasources>
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Please don't ignore the request to correct your display name. Your account will be closed soon.

Dave
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10263
    
168

Thanks for changing your display name.

While taking connection , it is not throwing any error.
I am not able to get connection using JNDI naming convention.


So can you post the code where you getting the connection using the JNDI name? Also if there is no exception thrown, what behaviour are you seeing? I mean what does not able to get connection mean? And what is the JNDI name you are using for getting the connection. Also, from where are you trying to get the connection? Is it from a standalone java program or is it from a jsp or servlet?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wht Jboss settings need to be done to get DB connection using JNDI