当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: Lightweight Directory Acces
 

 

 ·building a telephone/voice portal @ jdj    »显示摘要«
    摘要: last month we introduced the phonelet architecture and developer api for creating lightweight telephone/voice services in java. this article expands the automated answering machine with caller......
 ·evolving functionality @ jdj    »显示摘要«
    摘要: c++ brought into vogue the concept of interfaces, abstractness, and implementations. java went a step further and formalized them with proper keywords for each of the concepts. there are a subst......


A Three-Way Query @ JDJ

lightweight directory access protocol (ldap) is fast becoming a de facto access method for common directory information. xml is now the standard for data exchange on the web. the relational database, a technology for modeling data in table form, has always been the most popular way to store and retrieve application data.

how do these three technologies come together, other than the fact that theyre all buzzwords in the technology world? theyre all a way to represent data, which you can easily access using the powerful set of query capabilities they each provide. ldap data can be queried using ldap directory search, xml data can be queried using xpath, and relational database data can be queried using sql.

in this article i describe an employee information application that can use all three methods to store and query data. youll learn how to construct each kind of query and write java code to retrieve data, respectively. its of great value to you as a developer because youre likely to come across systems implemented using one of these technologies and be asked to develop applications on top of it.

the employee information application

{ 【程序编程相关:The Great Java Jobs

figure 1 shows the user interface of a simple employee information application, organizing employees by last name, first name, phone, and e-mail address.

each employee can be represented as a java object (seen below). in the next few sections, i discuss how this data can be represented and queried in various ways.

class employee 【推荐阅读:Single Aspect-Orient

private string lastname; 【扩展信息:SOA What? @ JDJ

private string id;

private string firstname;

private string phone;

private string e-mail;

}

relational database and sql

the relational database is a common way to model application data. you can model all the employee information described above into one table called employee. the id will be a unique key used to identify an employee.

create table employee

{

  id varchar(64)                        not null;

  lastname varchar(64)            null;

  firstname varchar(64)            null;

  phonenumber varchar(12)     null;

  e-mail varchar(64)                  null

}

create unique index indxemp on employee (id)

to retrieve data from relational database, use sql. most developers are familiar with sql, so i wont explain it here. a standard sql looks like this:

select <field1>, <field2>

from <table>

where <field1> = <value1>

and <field2> = <value2>

and ...

querying a relational database in java code

to access the database using java, you can use jdbc, the standard api for executing sql statements in any relational database. with jdbc, different drivers can be installed dynamically to access different databases. as a result, your code remains the same
...   下一页
 ·java applet used by u.s. army @ jdj    »显示摘要«
    摘要:approximately 40,000 u.s. army personnel worldwide can now submit their updated financial information online, along with a legally binding digital signature, using infomosaics securexml java applet. t......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE