Jdbc - beans

hy
jdbc: here are some new features added that are very fine for GUI applications, as I assume. making a ResultSet scrollable and updatable. I assume the feature Updatable was introduced for GUI applications, make changes in the UI take affect right to the database.
beans: beans can be bound to database tables, if I understood it right
when using new functionality of resultSets then no SQL-statements have to be created by the programmer, and i don't have to think about it (simply said).
as I saw in the NetBeans preview the same is for beans
can someone please explain me the difference from jdbc and beans? which technology is better for GUI applications? especially performance differences if someone has experience with it
thanks in advance

Java Beans and JDBC have both been around since JDK
1.0. There's nothing new. I haven't ment that those are new, but new features added
ResultSet can be
scrollable and updatable, but that depends on the
vendor who implements your driver.thanks, so I'm on the secure side if I use beans with jdbc
Beans aren't bound to tables. You're thinking of VB
or Seam.hm, then I misunderstood the new features of the coming NetBeans IDE 6.0
thanks for your fast and helpful answer

Similar Messages

  • JDBC Bean for JSP

    Any JDBC beans available for JSP? I know regular JDBC can be used but putting database connection logic in jsp sort of destroys its purpose. Are any beans in the works? Freeware/OSS beans?

    Yes, we are working on some JDBC-based beans to facilitate database access. Ours is not available yet, not sure about other freeware.

  • Jdbc bean errorpage - select - update

    i got a problem getting the errorhandling from a bean- i would like to open an errorpage from the bean when the executeupdate function fails - maybe due to an allready existing value
    if i move thedb access into a normal jsp i can declare a
    <%@page errorPage="errorpage.jsp" %>
    but how can i manage that within the bean ? - or should i put all the code into a jsp without trying to fit into the mvc modell ?
    import java.sql.* ;
    public class DbBean {
       private Connection con;
       private Statement st;
       private ResultSet rs;
       private Statement statement;
       public DbBean() {
         try {
           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           con = DriverManager.getConnection("jdbc:odbc:konten");
         catch (Exception e) {
           System.out.println("Fehler bei Verbindung zur Datenbank");
       public ResultSet get(String query) {
         try {
           st = con.createStatement();
           rs = st.executeQuery(query);
         catch (Exception e) {
           System.out.println("Fehler bei Datenbankabfrage" + e.getMessage());
         return rs;
       public void insertData(String query) {
         try {
           st = con.createStatement();
           st.executeUpdate(query);
         catch (SQLException sqle) {
           System.err.println(sqle.getMessage() + " !! Fehler beim InsertVersuch !!");
         catch (Exception e) {
           System.out.println("Fehler bei Datenbankupdateversuch" + e.getMessage());

    Well in order for the error page to come up, you have to give the jsp page an exception.
    Right now you are just catching the exception, printing a message, and continuing as normal.
    You will probably want to rethrow the exception so that it trickles down to the jsp where it can explode into a glorious error page.
    Cheers,
    evnafets

  • Extending JDBC service to take password and userid

    Current JDBC component does not take userid and password for creating datasource connection.
    Hence I am creating Custom JDBC Component.
    I am trying to embedd adobe-jdbc-dsc.jar file in my custom component.
    I want to re-use following editor and beans populated by these editors.
      <editor id="com.adobe.idp.dsc.jdbc.editor.xml.XmlDocumentInfoEditor">
       <description>Custom editor for creating XML document info bean</description>
       <ui-component-class type="eclipse">com.adobe.idp.dsc.jdbc.editor.xml.XmlDocumentInfoEditor</ui-component-clas s>
       <configuration-type>com.adobe.idp.dsc.jdbc.bean.XmlDocumentInfoBean</configuration-type>
      </editor>
      <editor id="com.adobe.idp.dsc.jdbc.editor.sql.SqlStatementInfoEditor">
       <description>Custom editor for creating SQL statement info bean</description>
       <ui-component-class type="eclipse">com.adobe.idp.dsc.jdbc.editor.sql.SqlStatementInfoEditor</ui-component-cla ss>
       <configuration-type>com.adobe.idp.dsc.jdbc.bean.SqlStatementInfoBean</configuration-type>
      </editor>
    These editors will return com.adobe.idp.dsc.jdbc.bean.SqlStatementInfoBean class and com.adobe.idp.dsc.jdbc.bean.XmlDocumentInfoBean.
    I want more information on above, what values will be populated inside SqlStatementInfoBean and XmlDocumentInfoBean?
    Can I extend com.adobe.idp.dsc.jdbc.JDBCService class provided by adobe?
    I want more documentation about above classes and how to extend JDBC service provided by Adobe.

    Hi
    These are the steps to do with forgotten passcodes:
    http://support.apple.com/kb/ht1212
    Unfortunately you will have to restore the device in the process
    Hope this helps

  • Why MYSQL error come

    when I deploy cmp bean on jboss-3.2.2 it gives following error (I use lomboz plugins):-
    5:53:11,197 INFO [EjbModule] Deploying FirstStat
    15:53:11,728 WARN [EntityContainer] No resource manager found for jdbc/MySqlDs
    15:53:13,320 ERROR [EntityContainer] Starting failed
    org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc.xml : datasource-mapping MYSQL not found
         at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEntityMetaData.java:433)
         at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDBCApplicationMetaData.java:310)
    Note:- Stateless or stateful bean created with dao, accessing of database normally.
    FirstStatBean.class
    * Created on Jan 23, 2006
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    package chaman.com;
    import java.rmi.RemoteException;
    import javax.ejb.EJBException;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    * <!-- begin-user-doc --> You can insert your documentation for '<em><b>FirstcmpBean</b></em>'. <!-- end-user-doc --> *
    <!-- begin-lomboz-definition -->
    <?xml version="1.0" encoding="UTF-8"?>
    <lomboz:EJB xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:lomboz="http://lomboz.objectlearn.com/xml/lomboz">
    <lomboz:entity>
    <lomboz:entityEjb>
    <j2ee:display-name>Firstcmp</j2ee:display-name>
    <j2ee:ejb-name>Firstcmp</j2ee:ejb-name>
    <j2ee:ejb-class>chaman.com.FirstcmpBean</j2ee:ejb-class>
    <j2ee:persistence-type>Container</j2ee:persistence-type>
    <j2ee:prim-key-class>java.lang.Integer</j2ee:prim-key-class>
    <j2ee:cmp-version>2.x</j2ee:cmp-version>
    <j2ee:abstract-schema-name>ecr</j2ee:abstract-schema-name>
    <j2ee:primkey-field>id</j2ee:primkey-field>
    </lomboz:entityEjb>
    <lomboz:fieldMappings>
    <lomboz:fieldName>id</lomboz:fieldName>
    <lomboz:fieldType>java.lang.Integer</lomboz:fieldType>
    <lomboz:columnName>id</lomboz:columnName>
    <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
    <lomboz:sqlType>INT</lomboz:sqlType>
    <lomboz:readOnly>false</lomboz:readOnly>
    <lomboz:primaryKey>true</lomboz:primaryKey>
    </lomboz:fieldMappings>
    <lomboz:fieldMappings>
    <lomboz:fieldName>fname</lomboz:fieldName>
    <lomboz:fieldType>java.lang.String</lomboz:fieldType>
    <lomboz:columnName>fname</lomboz:columnName>
    <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
    <lomboz:sqlType>VARCHAR</lomboz:sqlType>
    <lomboz:readOnly>false</lomboz:readOnly>
    <lomboz:primaryKey>false</lomboz:primaryKey>
    </lomboz:fieldMappings>
    <lomboz:fieldMappings>
    <lomboz:fieldName>lname</lomboz:fieldName>
    <lomboz:fieldType>java.lang.String</lomboz:fieldType>
    <lomboz:columnName>lname</lomboz:columnName>
    <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
    <lomboz:sqlType>VARCHAR</lomboz:sqlType>
    <lomboz:readOnly>false</lomboz:readOnly>
    <lomboz:primaryKey>false</lomboz:primaryKey>
    </lomboz:fieldMappings>
    <lomboz:fieldMappings>
    <lomboz:fieldName>phone</lomboz:fieldName>
    <lomboz:fieldType>java.lang.String</lomboz:fieldType>
    <lomboz:columnName>phone</lomboz:columnName>
    <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
    <lomboz:sqlType>VARCHAR</lomboz:sqlType>
    <lomboz:readOnly>false</lomboz:readOnly>
    <lomboz:primaryKey>false</lomboz:primaryKey>
    </lomboz:fieldMappings>
    <lomboz:tableName>address</lomboz:tableName>
    <lomboz:dataSourceName></lomboz:dataSourceName>
    </lomboz:entity>
    </lomboz:EJB>
    <!-- end-lomboz-definition -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.bean name="Firstcmp"
    *     jndi-name="Firstcmp"
    *     type="CMP"
    * primkey-field="id"
    * schema="ecr"
    * cmp-version="2.x"
    * data-source=""
    * @ejb.persistence
    * table-name="address"
    * @ejb.finder
    * query="SELECT OBJECT(a) FROM ecr as a"
    * signature="java.util.Collection findAll()"
    * @ejb.pk class="java.lang.Integer"
    * @ejb.resource-ref res-ref-name="jdbc/MySqlDs"
    * res-auth="Container"
    * @jbos.resource-ref res-ref-name="jdbc/MySqlDs"
    * jndi-name="java:/MySqlDS"
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract class FirstcmpBean implements javax.ejb.EntityBean {
    protected EntityContext eContext;
    * <!-- begin-user-doc -->
    * The ejbCreate method.
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.create-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public java.lang.Integer ejbCreate(Integer id, String fname,String lname, String phone ) throws javax.ejb.CreateException {
    // EJB 2.0 spec says return null for CMP ejbCreate methods.
    // TODO: YOU MUST INITIALIZE THE FIELDS FOR THE BEAN HERE.
    // setMyField("Something");
    // begin-user-code
         setId(id);
         setFname(fname);
         setLname(lname);
         setPhone(phone);
    return null;
    // end-user-code
    * <!-- begin-user-doc -->
    * The container invokes this method immediately after it calls ejbCreate.
    * <!-- end-user-doc -->
    * @generated
    public void ejbPostCreate(Integer id, String fname,String lname, String phone) throws javax.ejb.CreateException {
    // begin-user-code
    // end-user-code
    * <!-- begin-user-doc -->
    * CMP Field id
    * Returns the id
    * @return the id
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.persistent-field
    * @ejb.persistence
    * column-name="id"
    * jdbc-type="VARCHAR"
    * sql-type="INT"
    * read-only="false"
    * @ejb.pk-field
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract java.lang.Integer getId();
    * <!-- begin-user-doc -->
    * Sets the id
    * @param java.lang.Integer the new id value
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract void setId(java.lang.Integer id);
    * <!-- begin-user-doc -->
    * CMP Field fname
    * Returns the fname
    * @return the fname
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.persistent-field
    * @ejb.persistence
    * column-name="fname"
    * jdbc-type="VARCHAR"
    * sql-type="VARCHAR"
    * read-only="false"
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract java.lang.String getFname();
    * <!-- begin-user-doc -->
    * Sets the fname
    * @param java.lang.String the new fname value
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract void setFname(java.lang.String fname);
    * <!-- begin-user-doc -->
    * CMP Field lname
    * Returns the lname
    * @return the lname
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.persistent-field
    * @ejb.persistence
    * column-name="lname"
    * jdbc-type="VARCHAR"
    * sql-type="VARCHAR"
    * read-only="false"
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract java.lang.String getLname();
    * <!-- begin-user-doc -->
    * Sets the lname
    * @param java.lang.String the new lname value
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract void setLname(java.lang.String lname);
    * <!-- begin-user-doc -->
    * CMP Field phone
    * Returns the phone
    * @return the phone
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.persistent-field
    * @ejb.persistence
    * column-name="phone"
    * jdbc-type="VARCHAR"
    * sql-type="VARCHAR"
    * read-only="false"
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract java.lang.String getPhone();
    * <!-- begin-user-doc -->
    * Sets the phone
    * @param java.lang.String the new phone value
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract void setPhone(java.lang.String phone);
         /* (non-Javadoc)
         * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
         public void setEntityContext(EntityContext arg0) throws EJBException,
                   RemoteException {
              // TODO Auto-generated method stub
    this.eContext= arg0;
         /* (non-Javadoc)
         * @see javax.ejb.EntityBean#unsetEntityContext()
         public void unsetEntityContext() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
    this.eContext=null;
    jbosscmp-jdbc.class
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
    <jbosscmp-jdbc>
    <defaults>
    <datasource>java:/MySqlDS</datasource>
    <datasource-mapping>MYSQL</datasource-mapping>
    <preferred-relation-mapping>foreign-key</preferred-relation-mapping>
    </defaults>
    <enterprise-beans>
    <!--
    To add beans that you have deployment descriptor info for, add
    a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
    that contains the <entity></entity> markup for those beans.
    -->
    <entity>
    <ejb-name>Firstcmp</ejb-name>
    <table-name>address</table-name>
    <cmp-field>
    <field-name>id</field-name>
    <column-name>id</column-name>
    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>INT</sql-type>
    </cmp-field>
    <cmp-field>
    <field-name>fname</field-name>
    <column-name>fname</column-name>
    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>VARCHAR</sql-type>
    </cmp-field>
    <cmp-field>
    <field-name>lname</field-name>
    <column-name>lname</column-name>
    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>VARCHAR</sql-type>
    </cmp-field>
    <cmp-field>
    <field-name>phone</field-name>
    <column-name>phone</column-name>
    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>VARCHAR</sql-type>
    </cmp-field>
    </entity>
    </enterprise-beans>
    </jbosscmp-jdbc>

    thank u for sending solution.
    cmp file successfully deployed but one prob. creats, when i send parameters values of
    create method (create("suman","kumar")) through client file, it inserts data correctly in table
    but it gives following error(Table stru:- (id int auto_increment primary key, fname varchar(20), lname varchar(20)):-
    javax.ejb.CreateException: Primary key for created instance is null.
         at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:520)
         at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:208)
         at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:269)
         at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:736)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(

  • Swing is great !!!!!

    Hi guys I've been working in swing for a last 5 years developing a client server and a GUI library. I've been working in coding our java beans (MyJTable, MyPopupDataTextField etc,etc) and our data JDBC beans.
    The only thing I could say now is that the library is becoming very productive and that I'm enjoying swing programming !!! I'm sure that all work I have done in swing it would be more difficult implementing in dot net. I really learned a lot watching sun's swing code !!! Really the best GUI toolkit !!! Thanks to all swing team, and people who are in java forums for helping me during these years !!!!
    (The only painfull thing was switching from jdk1.3.1 to jdk1.4.2, lot of focus issues).

    I am not good at English, but I think swing is awful
    bad...I think the Swing developers were given a pretty tough egg to crack and they produced something that is reasonably flexible and gets the job done. Overall I doubt I could have done as good a job given ten times the time to do it. That being said, there is definitely a lot in Swing to learn from through examples of what not to do. Some horrible abuses of concrete inheritance (DefaultTableCellRenderer for example) and other bad code so I wouldn't call it ideal or even the "best".

  • Flex Directly To JdbcService

    I need to have a Flex form communicate with the LC database.  I see 4 ways to make this happen.
    Have Flex use a RemoteObject call to a custom written process that actually invokes a JDBC operation
    Have Flex use a RemoteObject call to a custom written process that uses the ExecuteScript activity to invoke the JDBC operation
    Have Flex use a RemoteObject call to a custom Java service component that invokes the JDBC operation
    Have Flex use a RemoteObject call to the JDBCService component directly
    I have done 1, 2 & 3 and while those are fine in most cases, at some points, I find myself wanted to use (4).  Has anyone done (4)?  In theory, it shouldn't be that hard, the problem I have is that in looking at the component.xml file, it looks like it is calling special classes, such as
    com.adobe.idp.dsc.jdbc.bean.SqlStatementInfoBean
    com.adobe.idp.dsc.jdbc.bean.XmlDocumentInfoBean
    which I would need to pass as part of the parameters in the Flex RemoteObject call.  Has one anyone done this?  Where would I find these classes and how would I create them within the Flex environment so that they could be used by the JdbcService?

    I don't think this way is possible.
    First reason is that the JdbcService doesn't have a Default Remoting Endpoint which is allows you to invoke from Flex.
    Or, In case, if the service is exposed over WSDL you can still try. Currently it is not exposed over WSDL.
    My opinion is to choose the option1, which is more convenient to use with external calls.
    Nith

  • Jsp/servlet web hosting companies?

    I'm planning on building a web site and would like to do it in java using jsp/servlets/jdbc/beans, and I'm looking for a good web hosting company that would provide the above technologies. Does anyone have any recommendations or links where I could find more information?

    http://www.servlets.com/isps/servlet/ISPViewAll

  • Declarative Transactions, Session Beans & JDBC

    Hi (this is really a newbie question),
    If I executed an SQL Update statement in a Stateless Session Bean via JDBC,
    is my call to the database enlisted in the container transaction
    automatically? (Of course, I am assuming the correct TxRequired settings
    are set on the deployment descriptors for the Session Bean.)
    Asked in another way, how does JDBC "talk" to the EJB container to let it
    know that it is being called within a Transactional Context and that all
    activities with the database should then be enlisted in a transaction
    automatically? Where does this "smartness" come in? Or does this not happen
    at all - do I have to "obtain" the JDBC connection object from the EJB
    container instead of writing directly to JDBC?
    Thanks in advance,
    Abdullah Kauchali

    Correct.
    I'd also recommend (where possible), doing the DataSource JNDI lookup in
    your setSessionContext method and storing it away in a member variable.
    There's usually no reason to do it on every method call.
    -- Rob
    Abdullah Kauchali wrote:
    Okay,
    After some investigations, this is what I've learned:
    1. To get automatic transactional enlistment (in a distributed tx), you
    have to make your EJB container aware of the JDBC datasource (viz. you have
    to create a Transactional DataSource). This is done by creating necessary
    entries in a configuration XML file so that the container can connect to the
    JDBC datasource when fired-up;
    2. You then only create your Connection object via a reference (JNDI to be
    exact) to the connection object and NOT directly with JDBC (this was my
    confusion in fact). Something like this:
    //obtain the conduit to the JNDI resource manager factory
    javax.sql.DataSource objDS = (javax.sql.DataSource)
    context.lookup("~some jndi
    reference~");
    //now get the connection object - notice no "javax" but "java"
    java.sql.Connection objCon = objDS.getConnection();
    3. By doing 2. above you are actually using a "Resource Manager Connection
    Factory" to get your Connection object for subsequent SQL Updates;
    4. As long as your JDBC driver supports the javax.sql.DataSource interface
    and provided Transactional Context is propagated from any root call to your
    worker Session Bean, you get automatic transaction enlistment of the SQL
    Updates with your EJB container;
    Please correct me if I have concluded wrongly,
    Regards
    Abdullah
    "Abdullah Kauchali" <ak@ak> wrote in message
    news:[email protected]...
    Hi (this is really a newbie question),
    If I executed an SQL Update statement in a Stateless Session Bean viaJDBC,
    is my call to the database enlisted in the container transaction
    automatically? (Of course, I am assuming the correct TxRequired settings
    are set on the deployment descriptors for the Session Bean.)
    Asked in another way, how does JDBC "talk" to the EJB container to let it
    know that it is being called within a Transactional Context and that all
    activities with the database should then be enlisted in a transaction
    automatically? Where does this "smartness" come in? Or does this nothappen
    at all - do I have to "obtain" the JDBC connection object from the EJB
    container instead of writing directly to JDBC?
    Thanks in advance,
    Abdullah Kauchali

  • How to specify JDBC Oracle url using deployment tool - Entity Bean

    Hello I'am new to EJB.
    When creating a entity bean-managed persistence and you need to specify the jdbc url with user name
    and password to establish a connection object, how does one specify that in the deployment
    tool?
    Heres an example of what has in the J2EE tutorial has in AccountEJB to get an connection object
    private String dbName = "java:comp/env/jdbc/AccountDB";
    private void makeConnection() throws NamingException, SQLException {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup(dbName);
    con = ds.getConnection();
    Now if my oracle jdbc url is to be jdbc:oracle:thin:@Abe:1521:dev
    ie My host is Abe, port number 1521 and database name of dev and username/password will be system/manager.
    what would my dbName be at the top?
    Would my JNDI lookup of a DataSource resource "java:comp/env/jdbc/AccountDB" become "java:comp/env/jdbc/dev" for starters?
    In the Resource Factories Reference Code I've add a reference of
    Coded Name: jdbc/dev
    Type: javax.sql.DataSource
    Authentication: Container
    and down the bottom of the I've put JNDI Name: MyAccount
    according to the AccountClient code of:
    Context initial = new InitialContext();
    Object objref = initial.lookup("MyAccount");
    and put User Name of "system" and Password of "manager"
    I'am sure in the source code I have to put
    Class.forName("oracle.jdbc.driver.OracleDriver")
    else you would get that no sutitable driver error, maybe you don't have to if ejb server is smart enough?
    What I'am confuse about is where to specify the jdbc url of "jdbc:oracle:thin:@Abe:1521:dev" ??
    Know it won't work because of this vital part. Do you have to put that somewhere else in the deployment tool or properties file, or some other tool??
    Please help
    Thanks
    Abraham Khalil

    When running the client after successful deployment with jdbc, I'am getting
    javax.naming.CommunicationException: java.rmi.MarshalException: CORBA MARSHAL 1398079699 Maybe; nested exception is:
    org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge : minor code: 1398079699 completed: Maybe
    org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge : minor code: 1398079699 completed: Maybe
    at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:923)
    at com.sun.corba.ee.internal.iiop.CDRInputStream.read_value(CDRInputStream.java:281)
    at com.sun.corba.ee.internal.corba.TCUtility.unmarshalIn(TCUtility.java:274)
    at com.sun.corba.ee.internal.corba.AnyImpl.read_value(AnyImpl.java:554)
    at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_any(CDRInputStream_1_0.java:605)
    at com.sun.corba.ee.internal.iiop.CDRInputStream.read_any(CDRInputStream.java:252)
    at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.readAny(Util.java:203)
    at javax.rmi.CORBA.Util.readAny(Unknown Source)
    at org.omg.stub.com.sun.enterprise.naming._SerialContextProvider_Stub.lookup(Unknown Source)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:133)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at AccountClient.main(AccountClient.java:21)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:151)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at AccountClient.main(AccountClient.java:21)
    One thing I don't like about EJB is that everything is transparent which is good! But its much
    harder to debug! :( Tried to see if I can figure it out. Hope someone has seen this problem before?

  • Question on Persistence (Entity Beans, Hibernate, JDBC)

    Hi everybody!
    Until now, I have read a lot about persistence in the J2EE-sector, but I am still confused about which technology to used in my case.
    I hope, that maybe you can give me some hints, by telling me which technology is good or bad regarding my requirements:
    I want to build a customer- and order-management system fullfilling the following requirements:
    1. The client is a Java application, the server is a JBOSS 4.0.1
    2. The databasa scheme exists already and I'm not allowed to change it.
    Some data, that logically belongs together and which shall be presented together to the client is distributed over 2 database tables.
    3. The user cannot just create new and view data, but will also edit existing data quite often.
    4. The user can assign products to an order. Often, there will be more than 1000 products assigned to an order, which will be presented to the user as a table (e.g. JTable). The user can then edit each cell of that 1000-row table, which of course will lead to an update in the db.
    5. The user can also assign customers to a specific role in an order-process. On the other hand, each customer can make many orders.
    So, we have a n:m relation here with the db-tables Customer, Order, OrderCustomer.
    6. A complex search functionality has to be implemented, where the db-query is created dynamically at runtime.
    7. The application is a multi-user application (about 10 users). It will be very rare, that users will work on the same data at the same time, but it might happen.
    8. The database type (SAP DB) will not be changed in the near future.
    With these 8 requirements in mind, I dealed a lot with EntityBeans, Hibernate and JDBC with SesseionBeans during the last 2 weeks.
    Until now, I came to the following conclusions.
    Hibernate is too slow. That'S bad, for data is edited very often and sometimes I want to edit just a single cell in 1000-row table.
    Hibernate's biggest advantage - that it makes your application independent of the database type - is not even required (see point 8).
    JDBC with SessioBeans: Very fast (I tried a simple query and it was about 10 times faster than Hibernate).
    The disadvantage is, that I have to take care about all the transaction, concurrency control etc. things.
    If I use JDBC, I want to do it that way: A SessionFacade accesses a DAO-object which executes the DB-query and returns the result to the SessionFacade which in the last step will pass the result to the client.
    Entity Beans: I am completely confused with Entity Beans.
    I read a lot about the CompositeEntity-Pattern for BMP. But on sun's J2EE Pattern page (http://java.sun.com/blueprints/corej2eepatterns/Patterns/CompositeEntity.html)
    they said, that it's just useful when using the EJB 1.1 specification, because from EJB 2.0. the container or whatever will take care about lazy loading and store optimization.
    So, from EJB 2.0. you should prefer using CMP-Beans with Container Managed Relationships (CMR), but as I heard, the dependent objects cannot be accessed and changed by the client when using CMPBeans with CMR.
    However, a simple DB/Entity-mapping will not work in my case, because as mentioned above, there are thousands of products from the db to be managed at the same time. So here, I thought, the Composite pattern with its lazy loading strategy would be useful.
    Furthermore, I have an n:m relationship in my database scheme, which is not trivial to map to entity beans. And don't forget that some related data is spread over 2 databse tables.
    To sum it up, it would be very nice if some of you could clarify this perisistence nightmare, especially some clarification about if and how to use EntityBeans when having n:m relationships, editing data a lot, managing lots of table rows at once and having related data distributed over 2 database tables.
    So, which technology would you prefer with the 8 requirements in mind? Hibernate, Entity Beans or JDBC with SessionBeans? Or would you prefer a mixed solution?
    Thanx for every hint.
    Regards,
    egon

    Here the requested information about the test:
    Goal:
    Find all customers, who's branches have the String "Branch" in their name.
    Both times, a simple client accesses the same SessionBean in a JBOSS-Container.
    This Bean has 2 methods. One accesses the DB via Hibernate (executeCriteria), the other one via JDBC (executeCriteriaJDBC).
    The code to count the seconds of computation is as follows:
    long startTime = System.currentTimeMillis();
    List customerList = bean.executeCriteria(dc);
    System.out.println("Hibernate: "+((System.currentTimeMillis()-startTime)/1000.0f)+" sek");
    startTime = System.currentTimeMillis();
    List customerListJDBC = bean.executeCriteriaJDBC(query);
    System.out.println("JDBC: "+((System.currentTimeMillis()-startTime)/1000.0f)+" sek");
    HIBERNATE:
    CODE:
    Branch Branch = new Branch();
    Branch.setName("%Branch%");
    Example example = Example.create(Branch);     
    DetachedCriteria dc = DetachedCriteria.forClass(Customer.class)
    .createCriteria("branches").add(example.enableLike()).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    QUERY:
    select
            this_.UUID as UUID1_1_,
            this_.NAME as NAME1_1_,
            this_.CUSTOMERNO as CUSTOMERNO1_1_,
            this_.SHORTDESC as SHORTDESC1_1_,
            this_.LONGDESC as LONGDESC1_1_,
            this_.TAXNUMBER as TAXNUMBER1_1_,
            this_.SALESTAXID as SALESTAXID1_1_,
            this_.ACCOUNTHOLDER as ACCOUNTH8_1_1_,
            this_.BANKACCOUNT as BANKACCO9_1_1_,
            this_.BANKCODE as BANKCODE1_1_,
            this_.BANKNAME as BANKNAME1_1_,
            this_.AREA1TEXT as AREA12_1_1_,
            this_.AREA2TEXT as AREA13_1_1_,
            this_.AREA3TEXT as AREA14_1_1_,
            this_.AREA4TEXT as AREA15_1_1_,
            this_.AREA5TEXT as AREA16_1_1_,
            this_.CH_UUID as CH17_1_1_,
            this_.REFTEXT1 as REFTEXT18_1_1_,
            this_.REFTEXT2 as REFTEXT19_1_1_,
            this_.REFTEXT3 as REFTEXT20_1_1_,
            branch1_.UUID as UUID0_0_,
            branch1_.NAME as NAME0_0_,
            branch1_.ILN as ILN0_0_,
            branch1_.BRANCHID as BRANCHID0_0_,
            branch1_.SHORTDESC as SHORTDESC0_0_,
            branch1_.LONGDESC as LONGDESC0_0_,
            branch1_.BAGSRECEIVED as BAGSRECE7_0_0_,
            branch1_.CUSTOMER_UUID as CUSTOMER8_0_0_
        from
            CUSTOMER this_,
            BRANCH branch1_
        where
            this_.UUID=branch1_.CUSTOMER_UUID
            and (
                branch1_.NAME like ?
    RESULT:
    Customername: Customer_A
    Customername: Customer_F
    Customername: Customer_D
    Customername: Customer_R
    Customername: Customer_S
    TIME:
    Hibernate: 1.343 sek
    JDBC:
    QUERY:
    Select distinct c.* from Customer c, Branch b where b.id=b.Customer_id and b.name like '%Branch%'
    // After getting the result of the query: Create a list of Customer-objects. Set all attributes of each Customer-object.
    RESULT:
    Customername: Customer_R
    Customername: Customer_A
    Customername: Customer_S
    Customername: Customer_D
    Customername: Customer_F
    TIME:
    JDBC: 0.125 sek
    The Customer.hbm.xml (auto-generated in Eclipse with Middlegen)
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
    <hibernate-mapping>
    <!--
        Created by the Middlegen Hibernate plugin 2.2
        http://boss.bekk.no/boss/middlegen/
        http://www.hibernate.org/
    -->
    <class
        name="hibernate.hibernate.Customer"
        table="CUSTOMER"
        lazy="false"
    >
        <id
            name="uuid"
            type="java.lang.String"
            column="UUID"
        >
            <generator class="assigned" />
        </id>
        <property
            name="name"
            type="java.lang.String"
            column="NAME"
            length="100"
        />
        <property
            name="customerno"
            type="java.lang.Integer"
            column="CUSTOMERNO"
            length="5"
        />
        <property
            name="shortdesc"
            type="java.lang.String"
            column="SHORTDESC"
            length="50"
        />
        <property
            name="longdesc"
            type="java.lang.String"
            column="LONGDESC"
            length="100"
        />
        <property
            name="taxnumber"
            type="java.lang.String"
            column="TAXNUMBER"
            length="50"
        />
        <property
            name="salestaxid"
            type="java.lang.String"
            column="SALESTAXID"
            length="50"
        />
        <property
            name="accountholder"
            type="java.lang.String"
            column="ACCOUNTHOLDER"
            length="50"
        />
        <property
            name="bankaccount"
            type="java.lang.String"
            column="BANKACCOUNT"
            length="50"
        />
        <property
            name="bankcode"
            type="java.lang.String"
            column="BANKCODE"
            length="50"
        />
        <property
            name="bankname"
            type="java.lang.String"
            column="BANKNAME"
            length="50"
        />
        <property
            name="area1text"
            type="java.lang.String"
            column="AREA1TEXT"
            length="50"
        />
        <property
            name="area2text"
            type="java.lang.String"
            column="AREA2TEXT"
            length="50"
        />
        <property
            name="area3text"
            type="java.lang.String"
            column="AREA3TEXT"
            length="50"
        />
        <property
            name="area4text"
            type="java.lang.String"
            column="AREA4TEXT"
            length="50"
        />
        <property
            name="area5text"
            type="java.lang.String"
            column="AREA5TEXT"
            length="50"
        />
        <property
            name="chUuid"
            type="java.lang.String"
            column="CH_UUID"
            length="50"
        />
        <property
            name="reftext1"
            type="java.lang.String"
            column="REFTEXT1"
            length="50"
        />
        <property
            name="reftext2"
            type="java.lang.String"
            column="REFTEXT2"
            length="50"
        />
        <property
            name="reftext3"
            type="java.lang.String"
            column="REFTEXT3"
            length="50"
        />
        <!-- Associations -->
        <!-- bi-directional one-to-many association to Branch -->
        <set
            name="branches"
            lazy="true"
            inverse="true"
           cascade="all"
        >
            <key>
                <column name="CUSTOMER_UUID" />
            </key>
            <one-to-many
                class="hibernate.hibernate.Branch"
            />
        </set>
    </class>
    </hibernate-mapping>So, seems to me like Hibernate is also getting the data from the Branch-Table related to each Customer. Maybe this is the reason, why Hibernate is slower.
    But as you can see in the mapping-File of the customer, I wanted Branches to be lazy loaded.
    Do you have any ideas, why Hibernate is so much slower? Any hints for optimizing that code?
    Do you have any further tricks to optimize Hibernate? Unfortunately I am not allowed to make changes at the database, so I cannot e.g. set indices for optimization.
    However, I�m a Hibernate-Newbie. In fact, I just made this test and was very disappointed about its result, so I didn�t keep on working with Hibernate.
    But maybe you can proof me, that Hibernate is a good choice. If so, do you have any good resources (links, books) that help working with Hibernate in connection with JBOSS, describe how to map n:m relationships, show how to work with large results and so forth?
    Thanx for help,
    egon

  • Connection Failure for JDBC system in Session Bean using JCA

    Hi,
    I am trying to write a session bean that runs a query
    against a JDBC system, but I keep seeing the following
    error in the default trace file in the J2EE log folder:
    14##0#0#Path##Java###Throwing
    #1#java.sql.SQLException: Invalid connection string
    attribute: Database name is required but not supplied#
    #1.5#
    This is the code, with the line marked (*) being the point where the exception is thrown:
    public void getConnection(String sURL, String sUser, String sPassword) {
    ManagedConnectionFactory mcf = null;
    IConnectionFactory cf = null;
    IConnectionSpec cs = null;
    try {
    mcf = new JDBCManagedConnectionFactory();
    cf = (IConnectionFactory) mcf.createConnectionFactory();
    cs = cf.getConnectionSpec();
    cs.setPropertyValue("UserName", "sa");
    cs.setPropertyValue("Password", "admin");
    cs.setPropertyValue"driver",
    "com.sap.portals.jdbc.sqlserver.SQLServerDriver");
    cs.setPropertyValue("url",
    "jdbc:sap:sqlserver://localhost:1433;DatabaseName=pubs");
    conn = cf.getConnectionEx(cs);  (*)
    I have tried adding another property value, like so:
    cs.setPropertyValue( "DatabaseName", "pubs");
    (or)  cs.setPropertyValue( "Database", "pubs" );
    but I still get the same exception. What does this
    exception really mean, what is missing from the
    configuration information ?
    Also, in the default trace file of the J2EE engine, the
    configuration information is printed out, but in an
    encrypted format, (see below), is it possible to have it
    print out this information in a readable format ?
    #1.5#005056A41E66006200000092000009AC000406E03C94F3D9#1133460065906#com.sap.portal.connectors.JDBC#sap.com/CFV3#com.sap.portal.connectors.JDBC#Guest#0####71758520629411daacf7005056a41e66#SAPEngine_Application_Thread[impl:3]_14##0#0#Info##Plain###UserName: ????n????????????????????d?????????????????????????????????????????????s???????????????????????????????????????????????0??????????????????????????????????????????????????h?????0??????R???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????s?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????c???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????u??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????c???????????????????????????????????????????c????????????????3?????????3????e??????????????????????????????????????????????????l???????0????????1????1?????????????????????????????????????????????????????????s?????p?????????????????????????????????????????????????????????????????6?????????????3??????????????s????????????????????t???????????s????????????????????????????????????????????????????????????????????????s????????????????????????????????????????????????????????s?????????????????????????????????g????????????????????????????????????????????????????????????????????????? Password: ******** URL: ???????????????n??????????????????????????????????????????????????????????????????????????0?????e??????????????????????????r?????????????s?????????????O??????????????2???????????7????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????:????5???T?????????????????????????l?????????1????????????????????????????????????????????????????????????????????????????2??????????????????????????????????????????????????????????????????????????????????????????????????h???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????a??????????????????????????????????????????????????????????????????????????????????????????????????S??????????????????????????????????????????????????????????????????????????????????2???????????????????????????u???????????????????????????????????????????????????????????????????????s???????????????????????????????????????????????????????????????????????????????????????????????s?????????????????????????????????????????.?????????????????????????????????????????????????????????????????1????????????????????????????????????l????5??????????? Driver: com.sap.portals.jdbc.sqlserver.SQLServerDriver#
    #1.5#0

    Hi Vladimir,
    thanks for your response. The reason I am accessing a
    JDBC source via JCA is to get a feel for how JCA works.
    What I ultimately want to do is construct a bean that can
    give queries to different kinds of sources; JDBC, and SAP
    (R3, CRM), and possibly sources like Siebel. For this, I
    believe I should use the Connector Gateway Service, as
    described in the "Using the JDBC Connector" and "Using
    the SAP Backend System Connector" sections of the SAP
    Portal Developer's Guide. But for now, my first approach
    was to use the approach described in "Connecting via
    J2EE" subsection of "Using the JDBC Connector" (see
    http://help.sap.com/saphelp_nw04/helpdata/en/30/a0f17aacb34b108b39a96acc33da3f/content.htm)
    Thanks,
    Colm.

  • How to use INSERT INTO ALL statement in jdbc prepared statement with beans

    Kindly give me some example that how we can use "INSERT INTO ALL STATEMENT" in jdbc prepared statement inside a jsf bean?
    Actually i want to take employee id's of present employees using single jsf page and using one textbox for each employee id.
    How can i use INSERT INTO ALL statement to achieve this?
    Following is my code snippet.
    AttendanceBean.java:
    public class AttendanceBean {
    private int atteid;
    private String attdname;
    private int attday;
    private int attmonth;
    private int attyear;
    public static Connection getAttConnection() throws Exception {
    String driver = "oracle.jdbc.driver.OracleDriver";
    String url = "jdbc:oracle:thin:@localhost:1521:globldb3";
    String username = "scott";
    String password = "tiger";
    Class.forName(driver);
    Connection conn = DriverManager.getConnection(url, username, password);
    return conn;
    public String addAttendance(){
    Connection conn = null;
    PreparedStatement pstmt = null;
    boolean committed = false;
    try {
    conn = getAttConnection();
    conn.setAutoCommit(false);
    String query = "INSERT ALL INTO attendance VALUES (?,?,?,?,?)";
    pstmt = conn.prepareStatement(query);
    pstmt.setInt(1,this.atteid);
    pstmt.setString(2,this.attdname);
    pstmt.setInt(3,this.attday);
    pstmt.setInt(4,this.attmonth);
    pstmt.setInt(5,this.attyear);
    pstmt.executeUpdate();
    conn.commit();
    conn.setAutoCommit(true);
    committed = true;
    return "home.xhtml";
    } catch (Exception e) {
    e.printStackTrace();
    return "CRM.xhtml";
    } finally {
    try{
    if (!committed) conn.rollback();
    if (pstmt != null) pstmt.close();
    if (conn != null) conn.close();
    }catch(Exception e){
    e.printStackTrace();
    }

    Check this program for some info on Push buttons:
    1-DEMO_DYNPRO_PUSH_BUTTON
    2-DEMO_DYNPRO_MODULE
    3-DEMO_DYNPRO_ON_CONDITION
    Suppose Your screen is 101
    Then in that screen create one push button and assign it a function code.
    Now in the PAI of the 101 screen
    Create Module for user command
    Inside that module checc the sy-ucomm if sy-ucomm eq <Function code of your push button>
    Insert the values in database.
    *& Module USER_COMMAND_0101 INPUT
    process after input for screen 0101 *
    MODULE USER_COMMAND_0101 INPUT.
    CASE OK_CODE.
    WHEN 'SAVE'.
    *Insert the values here
    WHEN 'DISP'.
    ENDCASE.
    CLEAR OK_CODE.
    ENDMODULE. " USER_COMMAND_0101 INPUT
    Regards
    Neha
    Edited by: Neha Shukla on Dec 3, 2008 1:02 AM
    Edited by: Neha Shukla on Dec 3, 2008 1:02 AM
    Edited by: Neha Shukla on Dec 3, 2008 1:06 AM

  • NullpointerException while returning XML bean from JDBC Control

    Hi,
    I have a simple jdbc control method which returns multiple rows of a table. i am trying to get the data in XML bean format and followed the instruction provided in the help documentation.
    None of the columns in table has null values.
    The exception I am getting is
    Exception in getActiveAlertList
    java.lang.NullPointerException
    at org.apache.beehive.controls.system.jdbc.RowToXmlObjectMapper.mapRowToReturnType(RowToXmlObjectMapper.java:102)
    at org.apache.beehive.controls.system.jdbc.DefaultXmlObjectResultSetMapper.mapToResultType(DefaultXmlObjectResultSetMapper.java:59)
    at org.apache.beehive.controls.system.jdbc.JdbcControlImpl.execPreparedStatement(JdbcControlImpl.java:365)
    at org.apache.beehive.controls.system.jdbc.JdbcControlImpl.invoke(JdbcControlImpl.java:223)
    Any help is appreciated.

    Hi!
    I?m facing this same problem.
    Have you found a solution?
    I also tried to migrate an WL 8 application, that works with a DB Control, but got the error anyway.
    If you, or someone else, found the solution, please share. I?d appreciate.
    Thanks.
    Gustavo

  • JDBC or Entity Beans for Read-Only Data?

    Entity beans are way to slow on pulling the amount of data I need. What are the cons of just using JDBC? Is this bad programming?
    One query pulls about 700 rows from 6 different tables taking up to 20 seconds. The same call using JDBC takes 2 seconds. What is the proper thing to do?

    One query pulls about 700 rows from 6 different
    tables taking up to 20 seconds. The same call using
    JDBC takes 2 seconds. What is the proper thing to do?JDBC. Entity beans are not really suited for data across multiple tables. This can be best done with plain SQL +JDBC.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • I downloaded current version of Firefox and it doesn't work.

    I downloaded the current version 7 of Firefox. I click it and the hourglass comes up but firefox won't load up. I had to go back to an older version which I really don't want to use. Can you tell me how to get the current version to work please? Than

  • How to read R & S phrases from EHS

    Dear All ,  I need to create a report  that will pull  data from EHS . Requirement is that if we go to CG04 and entered materal no and exe  after exeuting , go to  property tree and select any node say like " Regulation without transport"  then selec

  • Mini Controlled by MBP very Slow

    Hi all, i control my headless Mini with my MBP and sometimes although my wifi is at 7MB up/1.5MB down speeds the respond time for communication from MBP to Mini is exceptionally slow. On Screen Share on the MBP i do something or press a command on th

  • Missing Image Dreamweaver CS5

    Why does one of the logo images, in the top left corner, disapear when view in Live view and on the internet, but is present in design view and other pages. The page in  question is www.susanpidcock/Geology Collection/formations.html   This pages use

  • Overload/add functions in expression browser

    Hi, short question: Is it possible to add or overload functions in the expression browser? ( e.g. Str() ) Has anybody examples? Cheers frank