1 Reply Latest reply on Dec 5, 2003 3:51 AM by milowe

    Access with JBOSS

    ramymoneiry

      hi all
      how can I define the odbc connection in jboss . I want to connect to MS access from JBOSS .The jndi name in web.xml in war file is

      <resource-ref>
      <res-ref-name>jdbc/AcmeDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>


      right now I want to define and map the jndi name of the datasource to actual driver and database created by access .

      my url for Database is : jdbc:odbc:sample
      driver is : sun.jdbc.odbc.JdbcOdbcDriver

      please give me the steps and the files in jboss to define my JDBC connection to Access Database

      thanks

        • 1. Re: Access with JBOSS
          milowe

          Add this to your jboss-xml.
          <jboss-web>
          <resource-ref>
          <res-ref-name>jdbc/AcmeDB</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <jndi-name>java:/YourAccessDS</jndi-name>
          </resource-ref>
          </jboss-web>

          Your msaccess-ds.xml
          ...
          <local-tx-datasource>
          <jndi-name>YourAccessDS</jndi-name>
          ....

          Get a connection at run-time.
          Context ctx= new InitialContext();
          DataSource ds = (DataSource)initial.lookup("java:comp/env/jdbc/AcmeDB");
          Connection con = ds.getConnection();

          /micke