Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / December 2005

Tip: Looking for answers? Try searching our database.

JDeveloper question

Thread view: 
laredotornado@zipmail.com - 20 Dec 2005 21:49 GMT
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
Jon Martin Solaas - 28 Dec 2005 10:51 GMT
> 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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.