This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Need help urgent  RSS feed

Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to connect to Jboss3.2 & Mysql 3 .I have modified the mysql-ds.xml such that it now reads
Have pasted the mysql driver in appropriate places.
When I see the web-console i see the jdbc/MySqlDS under jboss.jca.
The log file also shows JNDI name bound to 'java:/jdbc/MySqlDS'
However when i try to use i from the client as:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces" );
Context ctx = new InitialContext(env);
DataSource ds = (DataSource) ctx.lookup("java:/jdbc/MySqlDS");
I get a NameNotBound :jdbc not bound Exception

I also tried this:
DataSource ds = (DataSource) ctx.lookup("jdbc/MySqlDS");
Still i get the same exception.
Please help.
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. First check that your mysql-ds.xml file is configured as follows (assuming that your database name is "XYZ"):
Note the tags <jndi-name> and <connection-url>
(just put DefaultDS rather than jdbc/MySqlDS if you want MySQL as your default database and simply delete the hsqldb-ds.xml file)
2. Within your code, just include the lines:
InitialContext ictx=new InitialContext();
DataSource ds=(DataSource)ictx.lookup("java:comp/env/jdbc/mydb");
Please note the standard enc format "java:comp/env". Also, note that the datasource name format "jdbc/mydb". Don't worry about the "mydb" part, just place any arbitrary name you like with the prefix "jdbc/"
Now deploy the whole thing. I hope it, should work now.
M. M. Islam Chisty
Dhaka, Bangladesh
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, have a look at the JMX console (i don't remember exactly the URL). It helps you a lot to check all your services and MBeans. You should be able to check whether your jdbc is bound or not.
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have similar problem. I checked my mysql-ds.xml - it's ok.
When I'm trying to get dataSource reference the error I get is the following:
javax.naming.NameNotFoundException: comp not bound
My code is as follows:
Context ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/mydb");
As there's no free docs available on this topic (at least I haven't found any), can anyone give me a peace of valuable advice?
One more question. How to redirect output of jboss console in Windows bat file? I cannot check the console output - it's too long.
Natkin Nat
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to run jboss3.2 with mysql4.0. I've copied the mysql-ds.xml from examples to default/deploy directory, changed <jndi-name> to DefaultDS in this file and removed hsqldb-ds.xml.

The output I have from jboss3.2 startup shows that it starts & binds hypersonic & tries to use hsqldb-ds.xml (which couldn't be found because I removed it).
Is there any configuration file in jboss where i can indicate that i want to use mysql-ds.xml & mysql database instead of hypersonic.
Please, help me to deal with this problem!
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the notes available here.
I had to tweak them a bit, but was able to do all of the various activities eventually. Using MySql is covered for the CMP example.
[ October 09, 2003: Message edited by: Barry Gaunt ]
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!