Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in CMP  RSS feed

 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends, i want to use CMP beans on weblogic 6.0sp1,
My problem is i am not able to understand how to tell the container, how to connect to database. ie which driver to use, which dsn, username and password of the database etc.
Plz help.
 
georgejk
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
The first step you have to do is create a connection pool in the weblogic server. Use the URL of the driver you are using. After this create a DataSource name which represents the connection pool you have created already. Once these steps are through, you are able to use this in ur CMP tto connect to the DB.
Thanks
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks fot the response,
i have made connection pool and data source but my problem is how to inform the server which datasource is to be used as there are more than one data source each representing different connection pool.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prakash -- I would strongly suggest that you read the free WebLogic 6.1 Workbook and Examples that accompanies Richard Monson-Haefel's EJB book. That should help you get started with developing and deploying EJB's in WebLogic 6.1.
Kyle
 
georgejk
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am giving you a sample code for the
"weblogic-cmp-rdbms-jar.xml" which is used for mapping to the datasource name & table name.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-rdbms-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB RDBMS Persistence//EN' 'http://www.bea.com/servers/wls600/dtd/weblogic-rdbms20-persistence-600.dtd'>
<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>FolderEJB</ejb-name>
<data-source-name>B2BDataSource</data-source-name>
<table-name>DBFOLDER</table-name>
<field-map>
<cmp-field>folderId</cmp-field>
<dbms-column>FOLDERID</dbms-column>
</field-map>
<field-map>
<cmp-field>folderName</cmp-field>
<dbms-column>FOLDERNAME</dbms-column>
</field-map>
<field-map>
<cmp-field>parentFolderId</cmp-field>
<dbms-column>PARENTID</dbms-column>
</field-map>
<field-map>
<cmp-field>userId</cmp-field>
<dbms-column>CREATEDBYUSERID</dbms-column>
</field-map>
<field-map>
<cmp-field>folderTypeId</cmp-field>
<dbms-column>FOLDERTYPEID</dbms-column>
</field-map>
</weblogic-rdbms-bean>
</weblogic-rdbms-jar>

Just notedown that--
<data-source-name>B2BDataSource</data-source-name>
this tag represents the datasource name created in the weblogic server.
I think ur doubt is much clear now.

george
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks george,
this is exactly what i was looking for
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!