|
WebLogic Server 7.0 Code Examples, BEA Systems, Inc. | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object | +--examples.dbkona.query
This simple example shows how to connect and execute queries with dbKona. You will need to have Oracle running the DEMO database, with WebLogic jDriver for Oracle (or another Oracle JDBC driver). This example is executed from the command line, and results are displayed to standard out. For other examples of how to display query results, check the server-side Java examples that use dbKona in the examples/servlets folder.
If you don't have the Oracle DEMO database, you can use the file utils/ddl/demo.ddl to set it up.
The following section describes how to build and run the examples:
set PATH=%PATH%;C:\bea\weblogic700\server\bin\oci817_8
set CLASSPATH=%CLASSPATH%;C:\bea
Properties props = new Properties();
props.put("user", "scott");
props.put("password", "tiger");
props.put("server", "DEMO");
You may need to replace these values to fit your configuration.
prompt> ant
prompt> javac -d %CLIENT_CLASSES% query.java
prompt> ant run_query
Buildfile: build.xml
run_query:
[java] Starting Loading jDriver/Oracle .....
[java] Record count = 14
[java] Record count = 2
[java] Record count = 2
[java] Record count = 2
[java] Record count = 2
[java] Record count = 2
[java] Record count = 2
[java] Record count = 2
[java] Record count = 0
[java] Name DB Type Type Length Prec Scale Null OK
[java] EMPNO NUMBER SHORT 4 4 0 no
[java] ENAME VARCHAR2 STRING 10 0 0 yes
[java] JOB VARCHAR2 STRING 9 0 0 yes
[java] MGR NUMBER SHORT 4 4 0 yes
[java] HIREDATE DATE TIMESTAMP 9 0 0 yes
[java] SAL NUMBER FLOAT 9 7 2 yes
[java] COMM NUMBER FLOAT 9 7 2 yes
[java] DEPTNO NUMBER BYTE 2 2 0 yes
[java]
[java] 7369 - SMITH - 1980-12-17 00:00:00.0
[java] 7499 - ALLEN - 1981-02-20 00:00:00.0
[java] 7521 - WARD - 1981-02-22 00:00:00.0
[java] 7566 - JONES - 1981-04-02 00:00:00.0
[java] 7654 - MARTIN - 1981-09-28 00:00:00.0
[java] 7698 - BLAKE - 1981-05-01 00:00:00.0
[java] 7782 - CLARK - 1981-06-09 00:00:00.0
[java] 7788 - SCOTT - 1987-04-19 00:00:00.0
[java] 7839 - KING - 1981-11-17 00:00:00.0
[java] 7844 - TURNER - 1981-09-08 00:00:00.0
[java] 7876 - ADAMS - 1987-05-23 00:00:00.0
[java] 7900 - JAMES - 1981-12-03 00:00:00.0
[java] 7902 - FORD - 1981-12-03 00:00:00.0
[java] 7934 - MILLER - 1982-01-23 00:00:00.0
BUILD SUCCESSFUL
| Constructor Summary | |
query()
|
|
| Method Summary | |
static void |
main(java.lang.String[] argv)
Here the JDBC connection is set up and created. |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public query()
| Method Detail |
public static void main(java.lang.String[] argv)
A QueryDataSet simplifies the client-side management of JDBC results by providing the infrastructure of a memory cache. QueryDataSets also allow records to be fetched incrementally. dbKona also provides methods associated with DataSets to automatically generate SQL. A QueryDataSet can be constructed with or without a JDBC ResultSet, which is shown in this method.
After working with the DataSet, we close it, as well as the JDBC ResultSet and the Statement used to execute the query.
|
Documentation is available at http://e-docs.bea.com/wls/docs70 |
|||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||