JBoss Community

Re: Sybase datasource config: New missing/unsatisfied dependencies

created by Carey Brown in Datasource Configuration - View the full discussion

Thanks for the input. Greatly appreciated. I also had missed the updating of web.xml and jboss-web.xml and didn't have the datasoure name correctly specified in the Java code.

 

Here's what it looked like when I finally got it to work.

 

Java souce code

 

private static final String DATA_SOURCE_NAME = "java:jboss/datasources/sybaseDS";

...

Context ctx = new InitialContext();

System.out.println( ctx );

DataSource dbSource = (DataSource)ctx.lookup( DATA_SOURCE_NAME );

ctx.close();

 

 

webapp/web/WEB-INF/web.xml

 

    <resource-ref>

        <res-ref-name>jdbc/sybaseDS</res-ref-name>

        <res-type>javax.sql.DataSource</res-type>

        <res-auth>Container</res-auth>

        <res-sharing-scope>Shareable</res-sharing-scope>

    </resource-ref>

 

 

webapp/web/WEB-INF/jboss-web.xml

 

<jboss-web>

    <resource-ref>

        <res-ref-name>jdbc/sybaseDS</res-ref-name>

        <jndi-name>java:jboss/datasources/sybaseDS</jndi-name>

    </resource-ref>

</jboss-web>

 

 

jboss-as-7.1.1.Final\modules\com\sybaseDS\sybase\main\module.xml

 

<module xmlns="urn:jboss:module:1.1" name="com.sybaseDS.sybase">

    <resources>

        <resource-root path="jconn4.jar"/>

        <!-- Insert resources here -->

    </resources>

    <dependencies>

        <module name="javax.api"/>

    </dependencies>

</module>

 

jboss-as-7.1.1.Final\standalone\configuration\standalone.xml

 

<datasources>

    <datasource jndi-name="java:jboss/datasources/sybaseDS"

        pool-name="sybaseDS" enabled="true">

        <connection-url>jdbc:sybase:Tds:10.250.5.27:5000</connection-url>

        <driver-class>com.sybase.jdbc4.jdbc.SybDriver</driver-class>

        <driver>sybaseDriver</driver>

        <security>

            <user-name>sa</user-name>

            <password>angels</password>

        </security>

    </datasource>

    <drivers>

        <driver name="sybaseDriver" module="com.sybaseDS.sybase"/>

    </drivers>

</datasources>

Reply to this message by going to Community

Start a new discussion in Datasource Configuration at Community