This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JBoss and the fly likes Not getting connection to Database using JNDI for JBoss 4.2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "Not getting connection to Database using JNDI for JBoss 4.2.0" Watch "Not getting connection to Database using JNDI for JBoss 4.2.0" New topic
Author

Not getting connection to Database using JNDI for JBoss 4.2.0

Amol Patil
Greenhorn

Joined: Aug 30, 2004
Posts: 8
Hi All,
I'm not able to get connection to PostgreSQL using JNDI.
I'm using JBoss 4.2.0. Can Anybody please tell which setting I need to do in JBoss?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8146
    
  52

How have you setup your datasource? What exception are you seeing if any? And please post the code where you are doing the lookup.


[My Blog] [JavaRanch Journal]
Shiney Thomas
Greenhorn

Joined: Jul 16, 2007
Posts: 3
Originally posted by Jaikiran Pai:
How have you setup your datasource? What exception are you seeing if any? And please post the code where you are doing the lookup.


Data Source is set up in properties.xml of Jboss (path is \jboss-4.2.0\server\default\deploy\container.war\manifest)
the code in properties.xml is
<?xml version="1.0" encoding="UTF-8"?>
<config>
<iface>
.............. some other code
<xmlpath>:/jboss-4.2.0/server/default/deploy/container.war/manifest</xmlpath>
<ds-datasource>java:/PostgresDS</ds-datasource>
<dc-datasource>java:/PostgresDS</dc-datasource>
<du-datasource>java:/PostgresDS</du-datasource>
</iface>
</config>

and the code in JAVA for lookup is .........(This is called to authenticate the Login/Password)

InitialContext ctx = new InitialContext();
AuthenticateUser_Home authenticateuser_home = (AuthenticateUser_Home)ctx.lookup("DSP1-aaa/AuthenticateUser");
AuthenticateUser authenticateuser = authenticateuser_home.create();
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8146
    
  52

"Shiney Baby"

Please check your private message, for a message from JavaRanch.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8146
    
  52

You will have to provide us more details. When you say, you are not able to connect to the database, what exactly are you seeing? Any exceptions? Also, the xml file that you posted is not the datasource file. The datasource file will be present in the deploy folder and its name will end with -ds.xml. Can you post the contents of that file?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Not getting connection to Database using JNDI for JBoss 4.2.0
 
Similar Threads
Extracting Client's IP
Keep JBoss running when database is down
JBoss 4.2.0 and Oracle 10g Configuration Issue with new DataSource
wht Jboss settings need to be done to get DB connection using JNDI
The console/command window disappears (jboss via run.bat)