Hello, I'm using JDeveloper and just starting out. How do I create a
datasource? The application server I'm using is JBoss 3.2.
Thanks, - Dave
> Hello, I'm using JDeveloper and just starting out. How do I create a
> datasource? The application server I'm using is JBoss 3.2.
>
> Thanks, - Dave
First of all you must create a descriptor defining the datasource and
deploy it in JBoss. Use one of the templates in
$JBOSS_HOME/docs/examples/jca and modify that. At the moment you drop
the file in the server/deploy directory jboss should pick it up, and
make it available through jndi.
Then, to have all your cmp ejbs use the datasource define the following
in your jbosscmp-jdbc.xml
<jbosscmp-jdbc>
<defaults>
<datasource>java:/SKEOracleDS</datasource>
<datasource-mapping>Oracle9i</datasource-mapping>
<create-table>false</create-table>
<remove-table>false</remove-table>
<read-only>false</read-only>
<time-out>300</time-out>
<pk-constraint>false</pk-constraint>
<fk-constraint>false</fk-constraint>
<row-locking>false</row-locking>
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
<read-ahead>
<strategy>on-load</strategy>
<page-size>1000</page-size>
<eager-load-group>*</eager-load-group>
</read-ahead>
<list-cache-max>1000</list-cache-max>
</defaults>
....
See jboss docs for the full syntax you can put in this file. Mapping
between columns and attributes, for instance, can be done here.
Ofcourse the datasource-name, "java:/SKEOracleDS", must match the name
in the datasource deployment descriptor from step 1. This is for an
ancient jboss 3.0.6 project though ... I don't know if things has
changed in current jboss 4. However, it may be that you don't want to
use cmp at all. In that case, you just grab the datasource thru a
jndi-query and connect the normal jdbc way:
Object object = getContext().lookup("java:/SKEOracleDS");
_dataSource = (DataSource) PortableRemoteObject.narrow(object,
DataSource.class);
This will work without the use of jbosscmp-jdbc.xml.
If you are talking about making datasources in JDeveloper, it's just a
matter of using the wizard, but, even though JDeveloper has some
rudimentary support for jboss it won't generate a jboss compatible
datasource xml descriptor for you from the datasources you define inside
JDeveloper.

Signature
jon martin solaas