Cmp and datasource

Hi,
I have a application with CMPs, and in my iAS there are 5 Data Sources.
How to configure an application to access a Data Source ?
Jordi Pinyol Essi Projects
Ingeniero de Desarrollo
[email protected] t +34 977 221 182
http://www.essiprojects.com f +34 977 230 170

Hello,I need to change at runtime the properties of
the connection, because my database has several users,
I am working with CMP EJB . How could I do it?
Thanks in advanceYou may write your own data source wich you will pass required data (user name) to through some thread oriented storage...
class Store {
static Map cache = new HashMap();
static void setUserName(String userName) {
    cache.put(new Integer(Thread.currentThread.hashCode()), userName);
static String gerUserName() {
    return (String)cache.get(new Integer(Thread.currentThread.hashCode()));
EJB:
setEntityContext(EC ec) {
   Store.setUserName(ec.getCallerPrincipal().getName());
YourDS:
getConnection() {
   return ds.getConnection(Store.getUserName(), ...);
...

Similar Messages

  • CMP and capture-schema problems

    I am trying to deploy a CMP on Sun App Server 8, and I'm having a few problems. I am quite new to both CMP and Sun App Server 8.
    I've created a simple table Room in mySQL DB, containing only id (varchar) and description (varchar). I'm running this command to capture the table schema
    capture-schema -username username -password pwd -dburl jdbc:mysql://localhost/test -driver com.mysql.jdbc.Driver -out test.dbschema
    Do I need to enter the -schemaname and -table parameters as well? I'm assuming that since the url is pointing directly to the test schema in mySQL and it only contains the room table, I don't need these 2 parameters.
    test.dbschema gets generated, but when I use the deployment tool and create the database mappings to the entity bean using this schema file, no mappings are created.
    Any help?

    Hello,
    I have similar problem and I'm really confused about it.
    Working with:
    Java System Application Server Platform Edition 8.1 2005Q1 UR1
    mysql DataSource and Container Managed Persistence
    mysql-connector-java-3.0.8-stable-bin.jar
    I have problem with deploy:
    Fatal Error from EJB Compiler -- JDO74025: JDOCodeGenerator: Caught an Exception validating CMP bean 'Sets' in application 'isvl' module 'isvl-EJBModule': JDO72335: If the table sets for the bean corresponding to the generated class isvl.model.set.SetBean470758938_JDOState is mapped as the primary table, it must have a primary key.Choose a different primary table or verify that the contents of the schema file are correct.
    Choose a different primary table or verify that the contents of the schema file are correct. at com.sun.ejb.codegen.CmpCompiler.compile(CmpCompiler.java:274) at com.sun.ejb.codegen.IASEJBC.doCompile(IASEJBC.java:615) at com.sun.ejb.codegen.IASEJBC.ejbc(IASEJBC.java:563) at com.sun.enterprise.deployment.backend.EJBCompiler.preDeployApp(EJBCompiler.java :340) at com.sun.enterprise.deployment.backend.EJBCompiler.compile(EJBCompiler.java:209) at com.sun.enterprise.deployment.backend.AppDeployer.runEJBC(AppDeployer.java:284) at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:176) at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.j ava:107) at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:146) at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPh ase.java:71) at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeplo ymentService.java:633) at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentSe rvice.java:188) at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentSe rvice.java:520) at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:143) at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:172)
    Have you seen this problem?
    Thanks.

  • Error in creating transfer rules beween infosource and datasource in BI 7.0

    Hello Guys
    I am gettting the following error when trying to create transfer rules between infosource and datasource.
    1. Error while activating transformation
    2. Deletion of Objects with Type Transformation
    3. Preprocessing/Collecting DDIC Objects for Transfor mation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    4. Post Processing/Checking the Deletion for Transfor mation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    5. Object Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K has been deleted
    6. Name of object of type 'TRCS' is missing
    7. Name of object of type 'TRCS' is missing
    8.Key rule 1 (target field: 0COMP_CODE): Initial update set
    9. Key rule 2 (target field: 0PLANT): Initial update set
    10. Key rule 3 (target field: 0OI_EBELN): Initial update set
    11. Key rule 4 (target field: 0AC_DOC_NO): Initial update set
    12. No rule exists
    13. Saving Objects with Type Transformation
    14. Saving Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    15. Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K saved successfully
    16. Activation of Objects with Type Transformation
    17. Saving Objects with Type Transformation
    18. Internal Activation (Transformation )
    19. Preprocessing / Creation of DDIC Objects for Trans formation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    20. Post Processing/Checking the Activation for Transf ormation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    21. Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K was activated
    22. Syntax error in GP_ERR_RSTRAN_MASTER_TMPL, row 1,644 (-> long text)
    23. Error during generation
    24. Error when activating Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    25. Resetting of Incorrect Objects Back to the Active Version (Transformation )
    26. Preprocessing / Creation of DDIC Objects for Trans formation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    27. Post Processing/Checking the Activation for Transf ormation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    28. Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K was activated
    29. Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K was reset to the active version
    Can anyone send me a document on how to create cubes, info and data sources,ODS's,multicubes and t/f and update rules in BI 7.0
    Thanks.

    Transformations in BI7
    http://help.sap.com/saphelp_nw04s/helpdata/en/f8/7913426e48db2ce10000000a1550b0/content.htm
    Regards,
    R.Ravi

  • Could I build 1:N relationship between CMP and BMP?

    Hi, as subject, Could I build 1:N relationship between CMP and BMP?
    Thanks a lot!
    a13519

    Container managed relationships only apply to CMP beans. You can look at the DTD in appendix B of the EJB spec or chapter 10 where they make this distinction.

  • Original System for transformations and DataSources

    Dear All,
    I have imported all DataSources and transformations from DEV box into QAS box. Transports ended without errors and they are working fine.
    I have the following questions, when check the Object Directory Entry (RSA1->Extras-> Object directory entry) for transformations and DataSources the Original System is QAS.
    Should not the original system be DEV?
    Transformations technical names in QAS are not the same as in DEV. Should not they have identical technical names?
    Details:
    BI70 SAP NetWeaver 2004s
    Support Packge 10
    Thanks,
    Carlos Weffer

    Transfornations' technical names change is normal.
    Also, when you see the object directory, the sysytem will eb Qa only as you would have converted the source system while transporting.
    Ravi Thothadri

  • Data binding - Arraycollection and Datasource

    Hi All
    1. Can any one paste a snippet of .MXML code and relevant WDA code (get_Attributes) for an ArrayCollection(Flex) and Datasource(WDA) data binding ?
    2. What is the procedure to set default values for the flex components at application initialisation. Already tried setting the relevant attributes in the WDODOINIT methods of  View and Componenet controller.  Also tried raising an event just after the FlashIsland.Register (this) delcaration in MXML but the event is not fired however subsequent events raised based on user clicks are raised properly. Any pointers as to what is being missed ?
    Thanks in advance
    ksQ

    Hi All
    1. Can any one paste a snippet of .MXML code and relevant WDA code (get_Attributes) for an ArrayCollection(Flex) and Datasource(WDA) data binding ?
    2. What is the procedure to set default values for the flex components at application initialisation. Already tried setting the relevant attributes in the WDODOINIT methods of  View and Componenet controller.  Also tried raising an event just after the FlashIsland.Register (this) delcaration in MXML but the event is not fired however subsequent events raised based on user clicks are raised properly. Any pointers as to what is being missed ?
    Thanks in advance
    ksQ

  • CMP and Serializable fields

    Hello,
    I would like to declare a field in an CMP Entity Bean to hold Serializable objects.
    It seems to work fine for primitive types and arrays of them but I get an exception as soon as I try to set the field via the bean remote interface with an instance of a user created class implementing Serializable :
    com.evermind.server.rmi.OrionRemoteException: Method invocation failed (Invalid return command: 6)
         void com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(java.lang.Throwable)
              RMIConnection.java:1499
         java.lang.Object com.evermind.server.rmi.RMIConnection.invokeMethod(com.evermind.server.rmi.RMIContext, long, long, java.lang.reflect.Method, java.lang.Object[])
              RMIConnection.java:1452
         java.lang.Object com.evermind.server.rmi.RemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
              RemoteInvocationHandler.java:55
         java.lang.Object com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
              RecoverableRemoteInvocationHandler.java:22
         void __Proxy1.setBehaviour(java.io.Serializable)
         void cern.laser.business.test.ConsoleConfigurationEntityEJBClient.main(java.lang.String[])
              ConsoleConfigurationEntityEJBClient.java:27
    The class looks like :
    public class MyClass implements java.io.Serializable
    private String s;
    public MyClass ()
    s = new String("ciao ciao");
    The corresponding database column is defined as BLOB.
    Thanks for your help,
    Francesco.

    Can any body tell me the relation between cmp and cmr
    fields in CMP beans
    Thanks in Advance
    SudhakarWe could say:
    If an Entity EJB is a record of a database table, a CMP is like a simple table column and a CMR represents a table column refering to a Foreign Key.
    Fil

  • Difference between Extraction Structure and Datasource

    Hi Gurus,
    I have a very basic question here.Can anybody explain to me in detail the difference between an extraction structure and Datasource.
    Thanks in advance

    Hi:
    I am pasting a summarized def. from sap notes.
    http://help.sap.com/saphelp_bw30b/helpdata/en/ad/6b023b6069d22ee10000000a11402f/frameset.htm
    Data Source:
    Data that logically belongs together is stored in the source system in the form of DataSources. A DataSource contains a number of fields in a flat structure used to transfer data into BW (Extract Structure).
    Extract Structure:
    In the extract structure, data from a DataSource is staged in the source system. The extract structure contains the amount of fields that are offered by an extractor in the source system for the data loading process.
    You can edit and enhance DataSource extract structures in the source system. To do this, in the BW Administrator Workbench choose Goto à Modeling à Source Systems à Your Source System à Context Menu (right mouse click) à Customizing Extractors à Subsequent Processing of DataSources.
    While, you are on the topic, you have one more structure.
    Transfer Structure:
    The transfer structure is the structure in which the data is transported from the source system into the SAP Business Information Warehouse.
    It provides a selection of the extract structure fields for the source system.
    It may be a good idea to look into a sample Business Content extractor to get a better understanding of how they are related.
    Chamarthy

  • CMP and BMP configure for deploying in weblogic

    how to run CMP and BMP in weblogic and configure in welogic
    tell me the steps to be followed for connection pooling and deployement and configure in weblogic builder....

    Disagree that CMP is always better than BMP. CMP is in reality merely an implementation of BMP that provides a declarative method of providing a persistence layer. You could easily use other declarative systems to provide the same service, but you are alway relying on BMP and when CMP fails to provide you need to return to the raw BMP.
    It a bit like the difference between high/low level languages. We don't normally write direct assembly (yes, I am aware that real programmers yada yada yada) but we do use it, and sometimes you actually have to write it for specialised applications - most notably for high performance.
    Both have their pluses and minuses, and you need to know when to use one over the other.

  • CMP and BMP in application

    I am new to EJB, please help me on this:
    Can i have mix of CMP and BMP in my application?
    Is it best enforce that all entity bean in either one but not both?

    You are impling that BMP is DB-dependent. The SQL generated by the >Container is nothing magical. It is no more DB independent than SQL >written by the developer. You don't have to be DB-specific to use BMP, >but you do have to be appserver-specific to use CMP.By Db independent I mean that the sql code for container call back methods is generated by Container. You dont have to do anything. If you are deploying bean for oracle or sql , container will take care for that. Refer to the specs There is brief para on advantages of CMP.
    For BMP you have to change the code according to the database. Container will not do anything for that.
    "2. Reduced development efforts."
    Yes, marginally, but the reduction in initial development time must >be weighed against:
    The tools (or lack thereof) provided to map the beans to the tablesWell even if you are working with BMP you have to be aware of that. There are various performance improvement setting which are app server specific. It doesnt matter if you are using BMP or CMP for that matter
    The time spent dealing with appserver vendors when things don't workOfcourse this happens with BMP also.
    The inherent limited flexibility of CMPAlmost 90 % of the scenarios can be delt with CMP. Yes if not you can use BMP.
    Also if time is such a factor, you should probably be generating your >beans (either CMP or BMP). This eliminates the development effort >difference between them. Of course that means developing BMP will be >faster since you don't have to muck about with the appserver, mapping >beans, marking methods as read-only, etc.Ha... I cannot take it. In general I can say It doesnt matter if you are using BMP or CMP , you have to be aware of different performance and other settings which are app server specific.
    Remember CMP is available for 2 reasons:
    1) So you can minimize development effort on simple Object-to-RDB >mappingsThey now support various relationships like 1-1,1-many, many-many
    2) So that the big vendors (IBM, BEA, etc.) who were involved in >drafting the spec can provide "features" not in the specification, >encouraging vendor lock-in. Any Specification is not complet or exaustive. Vendors need to fill the gap.
    --Ashwani

  • Can TopLink CMP and POJO persistence be mixed (for incremental migration)?

    Is it possible to mix TopLink CMP and POJO persistence in one application server container? Does anyone already have experiences with such a setting?
    Background: We currently maintain an application that uses Toplink as CMP 1.1 provider for its entity beans. As this architecture is quite out-dated, we'd like to move from CMP 1.1 to POJO based persistence with TopLink (native, no JPA) and Spring inside the appserver.
    Is only a "big-bang" migration feasible? Or is there a way to use CMP and POJO persistence with TL side-by-side in one container? That would extremely handy allowing us to migrate each entity bean at a time.
    I would very much appreciate your input/opinion!
    Sebastian
    Application server is Bea Weblogic 8.1SP6
    Toplink version is 9.0.4.9
    Java version is 1.4.2

    Thank you a lot for your answer!
    I understand that with SessionAccessor from the oracle.toplink.ejb.cmp package, we can get access to the current CMP session.
    We'd like to use the TopLinkDaoSupport class from Spring's TL integration and for this, Spring wants a session factory injected.
    Is there a way to get something like a TL session factory for use with Spring in a CMP environment?
    Thanks again for your time!
    Sebastian

  • Database connection timeouts and datasource errors

    Connections in the pool randomly die overnight. Stack traces show that for some reason, the evermind driver is being used even though the MySql connection pool is specified.
    Also, the evermind connection pool is saying connections aren't being closed, and the stack trace shows they're being allocated by entity beans that are definitely not left hanging around.
    Sometimes we get non-serializable errors when trying to retrieve the datasource (this is only after the other errors start). Some connections returned from the pool are still good, so the application limps along.
    EJBs and DAOs both use jdbc/SQLServerDSCore.
    Has anyone seen this problem?
    <data-sources>
         <data-source
              class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
              name="SQLServerDSCore"
              location="jdbc/SQLServerDSCore"
              xa-location="jdbc/xa/SQLServerXACore"
              ejb-location="jdbc/SQLServerDSCore"
              connection-driver="com.mysql.jdbc.Driver"
              min-connections="5"
              username="xxx"
              password="xxx"
              staleness-timeout="3600"
              alive-poll-query="SELECT 1 FROM medispan"
              url="jdbc:mysql://1.2.3.4:3306/dbo?autoReconnect=true&autoReconnectForPools=true&cachePrepStmts=true&is-connection-validation-required=true"
              inactivity-timeout="30"
         >
              <property name="autoReconnect" value="true"/>
              <property name="autoReconnectForPools" value="true"/>
              <property name="is-connection-validation-required" value="true"/>
              <property name="cachePrepStmts" value="true"/>
         </data-source>
    </data-sources>

    Rick,
    OC4J 9.0.4.0.0 - BTW, do you know of any patches?As far as I know, there are no patches for the 9.0.4
    production version of OC4J stand-alone.
    I'm using container managed persistence,It was not clear to me, from your previous post, that you
    are using CMP entity beans.
    I found staleness-timeout and alive-poll-query
    somewhere on a website when trying to track this
    down. Here's four sources:Those sources refer to OrionServer -- and an older version, too, it seems.
    Like all other Oracle products that start out as somebody
    else's -- including, for example, JBuilder (that became "JDeveloper"), Apache Web Server (that became "Oracle HTTP Server") and TopLink -- their development paths diverge, until, eventually, there is absolutely no similarity between them at all. Hence, the latest versions of OC4J and "OrionServer" are so different, that you cannot be sure that something that works for "OrionServer" will work for OC4J.
    I recall reading something, somewhere, sometime about configuring OC4J to use different databases (other than Oracle), but I really don't remember any details (since it was not relevant to me, because we only use Oracle database). In any case, it is possible to use a non-Oracle database with OC4J.
    Good Luck,
    Avi.

  • Performance problems with combobox and datasource

    We have a perfomance problem, when we are connecting a datatable object or something like this to a datasource property of a combobox. Below you find the source code. The SQL-Statement reads about 40000 rows and the result (all 40000) should be listed in the combobox. There is duration about 30 second before this process has finished. Any suggestions?
    Dim ds As New DataSet
    strSQL = "Select * from am.city"
    conn = New Oracle.DataAccess.Client.OracleConnection(Configuration.ConfigurationSettings.AppSettings("conORA"))
    comm = New Oracle.DataAccess.Client.OracleCommand(strSQL)
    da = New Oracle.DataAccess.Client.OracleDataAdapter(strSQL, conn)
    conn.Open()
    da.Fill(ds)
    conn.Close()
    Dim dt As New DataTable
    dt = ds.Tables(0)
    ComboBox1.DataSource = dt
    ComboBox1.ValueMember = dv.Table.Columns("id").ColumnName
    ComboBox1.DisplayMember = dv.Table.Columns("city").ColumnName

    But how long does it take to fill the DataTable?
    I can fill a 40000 row datatable in under 4 seconds.
    DataBinding a combo box to that many rows is pretty expensive, and not normally recommended.
    David
    Dim strConnection As String = "Data Source=oracle;User ID=scott;Password=tiger;"
    Dim conn As OracleConnection = New OracleConnection(strConnection)
    conn.Open()
    Dim cmd As New OracleCommand("select * from (select * from all_objects union all select * from all_objects) where rownum <= 40000", conn)
    Dim ds As New DataSet()
    Dim da As New OracleDataAdapter(cmd)
    Dim begin As Date = Now
    da.Fill(ds)
    Console.WriteLine(ds.Tables(0).Rows.Count & " rows loaded in " & Now.Subtract(begin).TotalSeconds & " seconds")
    outputs
    40000 rows loaded in 3.734375 seconds

  • CMP and Transaction Attribute

    Hi All!
    I try to play with cmp entity beans. All I try to do is find instance and call one from the methods.
    When I use transaction attribute another than "Required", I get exception 25222. Application module creation exception.
    If I change attribute to "Required New" then I get error while bean try to UPDATE record.
    I can't understand why this update appear on findByPrimaryKey!
    Can any body give some information on JBO behavior?
    Mike
    null

    I do one more test and found
    UPDATE exception raised when I have foreign key in table. If I use only plain fild evething is ok. If add to entity foreign key field container raise exception when it try to update record.

  • Connection pool and datasource

    In WL 7, we need to configure a datasource and a connection pool in order for the application to get a connection to the database. How is the datasource and connection pool related?
    In WL 9.2, there is no option to configure the connection pool, there is only the option to configure the data source. Where did the connection pool go in WL 9.2?

    gerald lee wrote:
    In WL 7, we need to configure a datasource and a connection pool
    in order for the application to get a connection to the database.
    How is the datasource and connection pool related?
    It depends on the WLS version. pre-9.X, there can be more than one datasource pointing to a given pool,
    but you do need a datasource typically to use a pool.
    In WL 9.2, there is no option to configure the connection pool, there is only
    the option to configure the data source. Where did the connection pool go in WL 9.2?In 9.X and beyond the relationship is one-to-one, and you will create both at the
    same time when creating a datasource.
    Joe

Maybe you are looking for