1 2 Previous Next 20 Replies Latest reply on Mar 12, 2004 4:32 AM by 101

    Cant connect to db

    aslani

      Am trying to connect to db from BMP bean but getting this error:

      14:16:08,140 INFO [EJBDeployer] Deployed: file:/D:/Udvikling/JBoss/jboss-3.2.3/
      jboss-3.2.3/server/default/deploy/OpenBroad-0.2.5_EJB.jar
      14:16:08,171 INFO [MainDeployer] Deployed package: file:/D:/Udvikling/JBoss/jbo
      ss-3.2.3/jboss-3.2.3/server/default/deploy/OpenBroad-0.2.5_EJB.jar
      14:16:24,765 ERROR [STDERR] javax.naming.NameNotFoundException: OpenBroadDB not
      bound


      this is my connection:

      public Connection getConnection()
       {
       Connection connection=null;
       try
       {
       Context initialContext = new InitialContext();
       DataSource ds = (DataSource) initialContext.lookup("java:comp/env/OpenBroadDB");
       connection = ds.getConnection();
       }
       catch (NamingException e)
       {
       e.printStackTrace();
       }
       catch (SQLException e)
       {
       e.printStackTrace();
       }
       return connection;
       }



      and this is my descripter that I deploy :


      <?xml version="1.0" ?>
      
      <datasources>
       <local-tx-datasource>
       <jndi-name>OpenBroadDB</jndi-name>
       <connection-url>jdbc:mysql://localhost/openbroad</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>root</user-name>
       <password></password>
       <min-pool-size>5</min-pool-size>
       <max-pool-size>100</max-pool-size>
       </local-tx-datasource>
      </datasources>



      can someone plz tell me what am doing wrong?

        • 1. Re: Cant connect to db

          Post your ejb-jar.xml and jboss.xml showing the <resource-ref> definition.

          I assume you don't have one of these.

          PS. This is an ejb question, your are in the wrong forum.

          Regards,
          Adrian

          • 2. Re: Cant connect to db
            aslani

            Hi adrian I dont have any <resource-ref> definition in neither ejb-jar.xml or jboss.xml.

            Am using XDoclet, so how could I solve this?

            • 3. Re: Cant connect to db
              aslani

              Anyway i tried like this with XDoclet:

              *@ejb.resource-ref
              * res-ref-name="OpenBroadDB"
              * res-type="DataSource"
              * res-auth="Container"


              But still I got the same error?

              • 4. Re: Cant connect to db

                Stop wasting people's time. I'm sure you can use search like I can.
                http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&q=jboss+resource-ref+xdoclet+example&btnG=Google+Search

                Regards,
                Adrian

                • 5. Re: Cant connect to db
                  aslani

                  I allready seached the google to find a solution to the error and couldn't find anything.

                  Then I asked here and why is that a problem for U?

                  • 6. Re: Cant connect to db

                    For other people who might be interested in the same solution
                    the search above (which I did for the questioner) reveals the following:

                    The first link shows the xdoclet docs for jboss.resource-ref

                    The fourth link shows a generic solution.

                    The fifth link shows eactly what you need to do in the a specific case.
                    * @jboss.resource-ref res-ref-name="jdbc/MySqlDS"
                    * jndi-name="java:/MySqlDS"

                    Mr aslani you are either blind or incompetent. I doubt I will be wasting
                    my time answering any of your future questions.

                    Regards,
                    Adrian

                    • 7. Re: Cant connect to db
                      aslani

                      Then don't.... lol

                      • 8. Re: Cant connect to db
                        billen

                        Hmm... I think "mr" Adrian needs another hobby. The way you are talking to other peoples is just making me sick. Aslani is asking a simple question (in the wrong forum, agreed) and is being polite in his comments.

                        If you dont wanna help people, then dont. But dont tell us. I personally have no interest in knowing, that your ego is to big for all "lowIQ" people.

                        Regards,
                        billen

                        • 9. Re: Cant connect to db
                          billen

                           

                          "adrian@jboss.org" wrote:

                          Mr aslani you are either blind or incompetent. I doubt I will be wasting
                          my time answering any of your future questions.


                          MY PRECIOUS...

                          • 10. Re: Cant connect to db
                            slaboure

                            Search in JBoss forums:

                            Search 1: " where author='billen' "
                            Result: 0

                            Search 2: " where author='adrian@jboss.org' "
                            Result: "Search found 4148 matches"


                            But don't worry, next time NukesForums will refresh its search engine DB, you will appear having 2 posts, both of them really helpful to the community, not like this precious Adrian, bored of people who cannot read after having answered to more than 4000 posts.

                            Cheers,



                            Sacha

                            • 11. Re: Cant connect to db
                              billen

                              That just dont make sence. My point is, that you shall not treat other people the way adrian is doing. I know adrian is good and being part of JBoss development, but that is no excuse for bad manners.

                              Regards,
                              billen

                              • 12. Re: Cant connect to db

                                It's not about ego or being bored.

                                It's about time wasters who are not prepared to do their own work.

                                We could answer every simple question posted in every wrong forum very politely,
                                regardless of how many times the question has been posted before.
                                We would end up doing nothing else but "holding the hand" of every incompetent,
                                when we could be helping people with real problems.

                                If you are not prepared to take hints like "you are in the wrong forum"
                                or "use search" - especially when the search is given to you.
                                Don't be surprised if we get annoyed.

                                Mr Billen, I'm sorry if you offended, but I'm trying my best to get
                                Mr Aslani to get off his lazy fat arse.

                                Regards,
                                Adrian

                                • 13. Re: Cant connect to db
                                  pilhuhn

                                   

                                  simple question (in the wrong forum, agreed) and is being polite in his comments.


                                  TANSTAFL.

                                  There are so many people out there that just operate in a "I don't want to read faq documents and I don't want to use search and I also don't want to read the articles posted within the last day, but I want a solution NOW. And no I don't want to pay in any way for it".

                                  I can understand Adrian's reaction.



                                  • 14. Re: Cant connect to db
                                    billen

                                    But I dont understand how you can make that assumption, that Aslani is either incompetent or have not tried his best in searching for an answer. I myself only ask in forums, when I have tried all other options. But not all documentations is that well written (do I have to mention xdoclet?).

                                    Regards,
                                    billen

                                    1 2 Previous Next