index.jpg

JDBaccess > FAQ

FAQ

Frequently asked questions (FAQ)

  1. What are the main features of JDBaccess ?

    JDBaccess is simple and fast. You could easily use functions and procedures and you could hide your application sql data.

  2. What does JDBaccess cost ?

    JDBaccess is for free. No additional fees such as runtime fees are charged. All upgrades between major versions are for free. Since JDBacces is simple, no additional training and consulting is needed.

  3. Which Java platform do I need ?

    JDBaccess works with the Java Standard Edition (Java SE). The Java Enterprise Edition (Java EE) is not needed.
    JDBaccess works with J2SE 1.4.2, J2SE 5.0 or Java SE 6.
  4. Which JDBC driver do I need ?  

    JDBaccess works with the JDBC drivers of MySQL and Oracle:

    • MySQL Connector/J: JDBaccess supports the MySQL Connector/J driver versions 5 (5.0.3) and 3.1 (3.1.13) so that MySQL 4 and MySQL 5 database systems can be connected.
    • OracleTM JDBC thin driver: JDBaccess supports the Oracle thin driver version 10 (10.1.0.4, 10.1.0.5, 10.2.0.1, 10.2.0.2) and 9 (9.2.0.5, 9.2.0.8) so that Oracle 8i, 9i and 10g database systems can be connected. We recommend to use the version 10 (10.1.0.5) which is faster than version 9.
  5. What is the optimal architecture of my application ?

    JDBaccess works with the Java Standard Edition (Java SE). No complex application server structure and no Java Enterprise Edition (Java EE) is needed.  This means you need to code fewer classes, interfaces and deployment descriptors. For example you no longer need to code entity inter-faces such as AddressHome and Address or deployment descriptors. And you no longer need to implement entity methods such as ejbRemove, ejbActivate, ejbPas-sivate, ejbLoad, ejbStore, setEntityContext, and unsetEntityContext.

    JDBaccess is used in a typical two-layer-architecture with a plain Java application client and a database server. But within the Java application client JDBaccess allows you to develop your application in a typical three-layer-architecture with presentation, application and persistence layer. JDBaccess is the software between your persis-tence layer in the client application and the JDBC driver for your database server.  JDBaccess supports the data access object and transfer object pattern.
  6. How do I start a JDBaccess application ?

    You should perform the following operations:
    DataSource ds = new DataSource(“dsName”, “dbUser”, “dbUserPW”, “dbServiceName”, “dbPort”, “dbHostName”);
    JDBaccess.setDataSource(ds);
    JDBaccess.start();
  7. How do I perform my transactions ?

    You start a transcation by:
      Transaction t = DAReader.getTransaction();
      t.begin();
    You commit a transcation by:
      t.commit();
    You rollback a transcation by:
      t.rollback();
    You end a transcation by:
      t.end();
  8. How do I insert my database rows ?

    You should perform for example the following operations:
    Insert insert = DAReader.getInsert(t);
    Row row1 = new Row();
    row1.setValueModified(“id”, new Long(4711));
    row1.setValueModified(“name”, “yourName”);
    Row row2 = new Row();
    row2.setValueModified(“id”, new Long(4712));
    row2.setValueModified(“name”, “yourName”);
    ArrayList transferObjects = new ArrayList();
    transferObjects .add(row1);
    transferObjects .add(row2);
    insert.setTOs(transferObjects);
    ArrayList createdTOs = insert.execute();
    insert.end();
  9. How do I update my database rows ?

    You should perform for example the following operations:
    Update update = DAFactory.getUpdate(t);
    Employee emp = new Employee();
    emp.setId(new Long(4711));
    emp.setValueModified("salary", new BigDecimal(20000));
    update.setTO(emp);
    update.execute();
    update.end();
  10. How do I delete a database row ?

    You should perform for example the following operations:
    Delete delete = DAFactory.getDelete(t1);
    Employee emp = new Employee();
    emp.setId(new Long(4711));
    delete.setTO(emp);
    delete.execute();
    delete.end();
  11. How do I select database rows ?
    You should perform for example the following operations:
    Select select = new Select();
    select.setSql("select * from employee");
    Result result = select.execute();
    ArrayList list = result.getAllElements();
    long count = result.getSize();
    select.end();

  12. How do I perform a procedure ?
    You should perform for example the following operations:
    Procedure procedure = DAReader.getProcedure(t);
    ArrayList params = new ArrayList();
    params.add(new Integer(4711));
    ArrayList outputParamTypes = new ArrayList();
    outputParamTypes.add("varchar");
    outputParamTypes.add("numeric");
    outputParamTypes.add("cursor");
    outputParamTypes.add("cursor");
    procedure.setProcedureName("prc_addSalaryPercent");
    procedure.setModuleName("pkg_employee");
    procedure.setParameters(params);
    procedure.setOutputParamTypes(outputParamTypes);
    ArrayList outputParams = procedure.getOutputParams();
    String success = (String) outputParams.get(0);
    // first result: employees before execution of procedure
    CallResult result1 = procedure.getResult(1);
    ArrayList elems1 = result1.getAllElements();
    // second result: employees after execution of procedure
    CallResult result2 = procedure.getResult(2);
    ArrayList elems2 = result2.getAllElements();
    procedure.end();
  13. How do I perform a function ?

    You should perform for example the following operations:
    Function function = DAReader.getFunction(t);
    ArrayList params = new ArrayList();
    params.add(new Integer(4711));
    ArrayList outputParamTypes = new ArrayList();
    outputParamTypes.add("numeric");
    function.setFunctionName("fnc_addSalaryPercent");
    function.setModuleName("pkg_employee");
    function.setParameters(params);
    function.setOutputParamTypes(outputParamTypes);
    ArrayList outputParams = function.getOutputParams();
    Object addedSalary = outputParams.get(0);
    function.end();
  14. How do I work with results of selects and procedures ?

    A result object (interface "Result") is returned by an execution of a select object. In a result you have methods for fetching elements (getAllElements, getNextElements, getPreviousElements, getFirstElement), for getting/setting a position (getPosition, setPosition),
    for setting the page size (setPageSize) and for reading large objects (setReadLobsFull).
    A call result (interface "CallResult") could be returned by a procedure. It is similar to a selection result but some methods such as page up and setting a position are not allowed per JDBC.
    Please have a look to the interface classes Result and CallResult to see all available methods.
  15. How do I hide my SQL code into xml files ?

    For example you could build following da.xml:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE da SYSTEM "com/jdbaccess/da/da.dtd">
    <da>
      <insert>
        <object>employee</object>
        <name>insertWithoutLobs</name>
        <sql>insert into employee(id,name,salary,creation,modification) values(?,?,?,?,?)</sql>
      </insert>
      <update>
        <object>employee</object>
        <name>updateSalaryById</name>
        <sql>update employee set salary = ? where id = ?</sql>
      </update>
      <select>
        <object>employee</object>
        <name>all</name>
        <sql>select * from employee</sql>
        <sql-count>select count(id) from employee</sql-count>
      </select>
      <procedure>
        <object>employee</object>
        <name>prc_addSalaryPercent</name>
        <module-name>pkg_employee</module-name>
        <proc-name>prc_addSalaryPercent</proc-name>
        <output-params>
          <param>varchar</param>
          <param>numeric</param>
          <param>cursor</param>
          <param>cursor</param>
        </output-params>
      </procedure> 
      <function>
        <object>employee</object>
        <name>fnc_addSalaryPercent</name>
        <module-name>pkg_employee</module-name>
        <func-name>fnc_addSalaryPercent</func-name>
        <output-params>
          <param>numeric</param>
        </output-params>
      </function> 
    </da>
  16. How do I end my JDBaccess application ?

    You should perform the following operation:
    JDBaccess.end();
  17. How are the mappings between SQL types and types of the Java programming language?

    JDBaccess maps SQL types to types of the Java programming language and vice versa in conformance to the Sun JDBC standard. For details read the JDBaccess manual.
  18. What is the performance of JDBaccess ?

    JDBaccess can’t be faster than JDBC itself, but it performs important operations by better usage of the JDBC methods. The average performance and throughput of applications with JDBaccess is much better than applications working with JDBC directly. We did a performance test on some typical client and server machines.
  19. MySQL: How do I insert/update values bigger than 2 MB ?
    To enable MySql for setting parameters bigger than 2 MB you should add the following line to your MySQL configuration file (e.g. my.cnf for Unix or my.ini for Linux, see mysql.org for details):
        max_allowed_packet=2M

  20. What are the next plans for JDBaccess ?

    In the next release it is planned to support more than one data soure with their connection and statement pools. Also it is planned to support further useful JDBC functionality such as named parameters in PL/SQL functions and procedures. And it is planned to support further RDBMS with their JDBC drivers such as DB2 UDB, MS-SQL-Server and MaxDB.

Powered By CMSimple.dk - Design By Websitetemplate.org