it-e-37 What is .NET

.NET is both a business strategy from Microsoft and its collection of programming support
for what are known as Web services, the ability to use the Web rather than your own computer for
various services. Microsoft's goal is to provide individual and business users with a seamlessly
interoperable and Web-enabled interface for applications and computing devices and to make
computing activities increasingly Web browser-oriented. The .NET platform includes servers;
building-block services, such as Web-based data storage; and device software. It also includes
Passport, Microsoft's fill-in-the-form-only-once identity verification service.
The .NET platform is expected to provide:
The ability to make the entire range of computing devices work together and to have user
information automatically updated and synchronized on all of them.
Increased interactive capability for Web sites, enabled by greater use of XML (Extensible
Markup Language) rather than HTML.
A premium online subscription service, that will feature customized access and delivery of
products and services to the user from a central starting point for the management of various
applications, such as e-mail, for example, or software, such as Office .NET.
Centralized data storage, which will increase efficiency and ease of access to information, as
well as synchronization of information among users and devices.
The ability to integrate various communications media, such as e-mail, faxes, and
telephones.
For developers, the ability to create reusable modules, which should increase productivity
and reduce the number of programming errors.
According to Bill Gates, Microsoft expects that .NET will have as significant an effect on
the computing world as the introduction of Windows. One concern being voiced is that
although .NET's services will be accessible through any browser, they are likely to function more
fully on products designed to work with .NET code.

The full release of .NET is expected to take several years to complete, with intermittent
releases of products such as a personal security service and new versions of Windows and Office
that implement the .NET strategy coming on the market separately. Visual Studio .NET is a
development environment that is now available. Windows XP supports certain .NET capabilities.

 

1, interoperable  [,intə'ɔpərəbl]
adj. 彼此协作的;能共同操作的;能共同使用的
2, intermittent  [,intə(:)'mitənt]
a. 间歇的,断断续续的

Continue reading it-e-37 What is .NET

自己动手写jsonp

jsonp是解决跨域调用的一种方法,主要是通过script标签允许跨域的原理来实现。

下面就是示例代码:

			var head = document.getElementsByTagName("head")[0];			
			var j = document.createElement("script");
			j.type = "text/javascript";
			if (c){
				var id='tpc'+new Date().getTime();
				src += '&jsonpid='+id;
                        //the response should call the function passed by jsonpid  
				window[id] = function(r){c(r);window[id]=null;};				
			}
			j.onload = j.onreadystatechange = function() {
				if ((!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {		
                              //ie hack
					j.onload = j.onreadystatechange = null;
					if (head && j.parentNode) {
						head.removeChild(j);
					}
				}
			}
			j.src = src + '&tmp=' + new Date().getTime();
			head.appendChild(j);
		

需要注意的问题是:

IE下onload事件触发不了,但是有onreadystatechange事件,

script标签设置一次src后,再改动它的src是没有效果的,所以必须每次创建,然后删除。

上面的例子还需要服务端返回的script内容调用传入的函数名来达到传递参数的效果。

还没有想到失败事件怎样实现?

Continue reading 自己动手写jsonp

it-e-36 Brief Introduction of SQL

SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to
communicate with a database. According to ANSI, it is the standard language for relational
database management systems. SQL statements are used to perform tasks such as update data on
a database, or retrieve data from a database. Some common relational database management
systems that use SQL are:Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc. [1]Although
most database systems use SQL, most of them also have their own additional proprietary
extensions that are usually only used on their system. However, the standard SQL commands
such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish
almost everything that one needs to do with a database.
A relational database system contains one or more objects called tables. The data or
information for the database are stored in these tables. Tables are uniquely identified by their
names and are comprised of columns and rows. Columns contain the column name, data type,
and any other attributes for the column. Rows contain the records or data for the columns. Here is
a sample table called "weather".
City, state, high, and low are the columns. The rows contain the data for this table:

The select statement is used to query the database and retrieve selected data that match the
criteria that you specify. Here is the format of a simple select statement:
select "column1"
[,"column2",etc]
from "tablename"
[where "condition"];
[] = optional

The column names that follow the select keyword determine which columns will be returned
in the results. You can select as many column names that you'd like, or you can use a "*" to
select all columns.
The table name that follows the keyword from specifies the table that will be queried to
retrieve the desired results.
The where clause (optional) specifies which data values or rows will be returned or
displayed, based on the criteria described after the keyword where.
The create table statement is used to create a new table. Here is the format of a simple create
table statement:
create table "tablename"
("column1" "data type",
"column2" "data type",
"column3" "data type");
Format of create table if you were to use optional constraints:
create table "tablename"
("column1" "data type"
[constraint],
"column2" "data type"
[constraint],
"column3" "data type"
[constraint]);
[ ] = optional
Note: You may have as many columns as you'd like, and the constraints are optional.
Example:
create table employee
(first varchar(15),
last varchar(20),
age number(3),
address varchar(30),
city varchar(20),
state varchar(20));
[2]To create a new table, enter the keywords create table followed by the table name,
followed by an open parenthesis, followed by the first column name, followed by the data type
for that column, followed by any optional constraints, and followed by a closing parenthesis. It is
important to make sure you use an open parenthesis before the beginning table, and a closing
parenthesis after the end of the last column definition. Make sure you separate each column
definition with a comma. All SQL statements should end with a ";".
The table and column names must start with a letter and can be followed by letters, numbers,

or underscores ê not to exceed a total of 30 characters in length. Do not use any SQL reserved
keywords as names for tables or column names (such as "select", "create", "insert", etc).
Data types specify what the type of data can be for that particular column. If a column
called "Last_Name", is to be used to hold names, then that particular column should have a
"varchar" (variable-length character) data type.
Note:Here are the most common data types:
char(size) Fixed-length character string. Size is specified in parenthesis. Max 255 bytes.
varchar(size) Variable-length character string. Max size is specified in parenthesis.
number(size) Number value with a max number of column digits specified in parenthesis.
Date Date value
number(size,d)
Number value with a maximum number of digits of "size" total, with a
maximum number of "d" digits to the right of the decimal.
What are constraints? When tables are created, it is common for one or more columns to
have constraints associated with them. A constraint is basically a rule associated with a column
that the data entered into that column must follow. For example, a "unique" constraint specifies
that no two records can have the same value in a particular column. They must all be unique. The
other two most popular constraints are "not null" which specifies that a column can't be left blank,
and "primary key". A "primary key" constraint defines a unique identification of each record (or
row) in a table.
The insert statement is used to insert or add a row of data into the table.
To insert records into a table, enter the key words insert into followed by the table name,
followed by an open parenthesis, followed by a list of column names separated by commas,
followed by a closing parenthesis, followed by the keyword values, followed by the list of values
enclosed in parenthesis. The values that you enter will be held in the rows and they will match up
with the column names that you specify. Strings should be enclosed in single quotes, and
numbers should not.
insert into "tablename"
(first_column,...last_column)
values (first_value,...last_value);
In the example below, the column name first will match up with the value 'Luke', and the
column name state will match up with the value 'Georgia'.
Example:
insert into employee
(first, last, age, address, city, state)
values ('Luke', 'Duke', 45, '2130 Boars Nest',
'Hazard Co', 'Georgia');
Note: All strings should be enclosed between single quotes: 'string'

Updating Records
The update statement is used to update or change records that match a specified criteria.
This is accomplished by carefully constructing a where clause.
update "tablename"
set "columnname" =
"newvalue"
[,"nextcolumn" =
"newvalue2"...]
where "columnname"
OPERATOR "value"
[and|or "column"
OPERATOR "value"];
[ ] = optional
Examples:
update phone_book
set area_code = 623
where prefix = 979;
update phone_book
set last_name = 'Smith', prefix=555, suffix=9292
where last_name = 'Jones';
update employee
set age = age+1
where first_name='Mary' and last_name='Williams';
Deleting Records
The delete statement is used to delete records or rows from the table.
delete from "tablename"
where "columnname"
OPERATOR "value"
[and|or "column"
OPERATOR "value"];
[ ] = optional
Examples:
delete from employee;
Note: if you leave off the where clause, all records will be deleted!
delete from employee
where lastname = 'May';
delete from employee
where firstname = 'Mike' or firstname = 'Eric';

To delete an entire record/row from a table, enter "delete from" followed by the table name,
followed by the where clause which contains the conditions to delete. If you leave off the where
clause, all records will be deleted.
The drop table command is used to delete a table and all rows in the table.
To delete an entire table including all of its rows, issue the drop table command followed by
the table name. Drop table is different from deleting all of the records in the table. Deleting all of
the records in the table leaves the table including column and constraint information. Dropping
the table removes the table definition as well as all of its rows.
drop table "tablename"
Example:
drop table myemployees_ts0211;

 

 

1, clause  [klɔ:z]
n. 分句,从句,条款,款项

2, parenthesis  [pə'renθisis]
n. 括弧,插入语,附带
3, criteria 
n. 标准

Continue reading it-e-36 Brief Introduction of SQL

it-e-35 National Geochemical Database

The broad objective of this project is to maintain and enhance the National Geochemical
Database (NGDB). The NGDB consists of 1) the original RASS and PLUTO data from the
USGS labs, which are now stored in a common format under the ORACLE relational database
management system; 2) the NURE data, which have been reformatted and reside currently on the
following web site: http://pubs.usgs.gov/of/1997/ofr-97-0492/ where downloads may be made on
the basis of 1:250,000-scale quadrangles; and 3) the newly generated data (approximately 1996þ
present) which reside on the Laboratory Information Management System. The enhancements to
the NGDB will enable both USGS scientists and external customers to more easily extract
immediately useable data on a national, regional, and local scale to help establish a baseline for
the abundance and spatial distribution of chemical elements in the Earth's surficial materials.
Specific short-term objective include:
Linking the newly developed ORACLE-based database to the Laboratory Information

Management System (LIMS) to provide for the smooth transfer of newly generated data from the
LIMS to the NGDB.
Implement the new Sample Submittal Information procedure on a nationwide basis
throughout the USGS. This procedure has only been implemented at this time (June 2002) in the
Central Region. Without this new system in place, it is possible that more errors and omissions
regarding the nature and location of samples may be generated.
Complete the re-formatting of the NURE HSSR database based on 1:250,000-scale
quadrangles, compile the quadrangle-based data into one large data set, and provide these data to
the public via a web site and CD/DVD.
Complete the upgrading of archival USGS geochemical data for Alaska and release these to
the public via a web site and CD/DVD.
Initiate the upgrading of the remainder (non-Alaska) portion of the USGS-generated data.
Generate subsets of the master databases containing data in a format more useful to geochemists so
they do not have to wade through the process of extracting the data they need from the entire database.
Communicate and coordinate the work within this Project with other data delivery efforts
within the Bureau such as NatWeb, GEODE, and Spatial Data Delivery.
Produce map representations of the database showing the spatial variation of chemical
species throughout the nation and within sub-regions that are of priority to the USGS.
Relevance and Impact
An accurate, easily accessible geochemical database containing multi-element information
on the surficial materials of the nation is vital if the USGS is to respond quickly to earth science
issues raised by Congress and land management and environmental protection agencies. A
nationally consistent geochemical database provides baseline information on the natural
abundance and spatial variation of chemical elements to which changes caused by agricultural
and irrigation practices, waste disposal, urbanization, industrial pollution, mineral exploration
and mining activities, environmental induced and restoration activities, and other land-use
practices can be compared. Human-induced chemical changes to the environment are
superimposed on a variable natural geochemical background where trace-element abundances
can range over several orders of magnitude within short distances. These variations are
inadequately documented and their existence is often overlooked in the setting of public policy.
Important aspects of change cannot be measured, or their consequences anticipated, unless the
present composition of the earth's surface materials is known. In her 2000 Presidential address to
the Geological Society of America, Mary Lou Zoback identified six "grand challenges in earth
and environmental science". The first of these was "recognizing the signal within the natural
variability". Zoback stated that "documenting and understanding natural variability is a vexing
topic in almost every environmental problem. How do we recognize and understand changes in
natural systems if we don't understand the range of baseline values?" Preserving and enhancing
the vast amount of geochemical data within MRP's databases will provide a powerful tool for
addressing this "grand challenge". The ultimate goal of producing and electronically

disseminating the vast amount of geochemical data within MRP's databases directly supports
many of the goals and objectives as stated in the Science Strategy of the Geologic Division
(Bohlen and others, 1999). These databases are essential for understanding the relationship
between geologic processes and human health, ecosystem structure and function, and the
distribution of energy and mineral resources. This project also serves as the focal point of
requests for geochemical data from outside customers. From June 2001 through May 2002, the
predecessor project (National Geochemical Database Project) received over 100 requests for data
from Federal, state, and local government clients; private sector clients; and internal USGS
clients. At a conservatively estimated cost of $300 per sample for collection, preparation, and
chemical analysis, the geochemical databases under MRP management represent an expenditure
of over $500 million of taxpayer money. To realize the fullest possible return for this investment,
these data must be archived in perpetuity in an easily accessible and user-friendly format for full
utilization by the wide array of customers that need geochemical data to accomplish their work.

 

1, geochemical  [,dʒi:ə'kemikəl]
adj. 地球化学的

2, spatial  ['speiʃəl]
a. 空间的

3, surficial  [sə:'fiʃəl]
adj. 地表的;地面的

4, omission  [əu'miʃən]
n. 疏忽,遗漏;省略;冗长
5, quadrangle  ['kwɔdræŋɡl]
n. 四边形;方院
6, wade  [weid]
v. 跋涉
7, portion  ['pɔ:ʃən]
n. 部分,份,命运
v. 将...分配,分配
8, species  ['spi:ʃiz]
n. 物种,种类
9, relevance 
n. 中肯,适当,关联,相关性
10, irrigation  [,iri'geiʃən]
n. 灌溉
11, urbanization  [,ə:bənai'zeiʃən, -ni'z-]
n. 都市化;文雅化
12, remediation  [ri,mi:di'eiʃən]
n. 补救;矫正;补习
13, induced 
感应的
14, vexing 
adj. 烦恼
15, ecosystem  [i:kə'sistəm]
n. 生态系统

16, geologic  [dʒiə'lɔdʒik]
a. 地质的

17, predecessor  ['pri:disesə, 'pre-]
n. 前任,前辈

18, expenditure  [iks'penditʃə, eks-]
n. (时间、劳力、金钱等)支出,使用,消耗

19, perpetuity  [,pəpi'tjuiti]
n. 永恒,永久

Continue reading it-e-35 National Geochemical Database

it-e-34 Structure of the Relational Database

The relational model is the basis for any relational database management system (RDBMS).
[1]A relational model has three core components: a collection of objects or relations, operators
that act on the objects or relations, and data integrity methods. In other words, it has a place to
store the data, a way to create and retrieve the data, and a way to make sure that the data is
logically consistent.
A relational database uses relations, or two-dimensional tables, to store the information
needed to support a business. Let's go over the basic components of a traditional relational
database system and look at how a relational database is designed. Once you have a solid
understanding of what rows, columns, tables, and relationships are, you'll be well on your way to
leveraging the power of a relational database.

A table in a relational database, alternatively known as a relation, is a two-dimensional
structure used to hold related information. A database consists of one or more related tables.
NoteDon't confuse a relation with relationships. A relation is essentially a table, and a
relationship is a way to correlate, join, or associate two tables.
A row in a table is a collection or instance of one thing, such as one employee or one line
item on an invoice. [2]A column contains all the information of a single type, and the piece of data
at the intersection of a row and a column, a field, is the smallest piece of information that can be
retrieved with the database's query language. For example, a table with information about
employees might have a column called LAST_NAME that contains all of the employees' last
names. Data is retrieved from a table by filtering on both the row and the column.

The examples throughout this article will focus on the hypothetical work of Scott Smith,
database developer and entrepreneur. He just started a new widget company and wants to
implement a few of the basic business functions using the relational database to manage his

Human Resources (HR) department.
Relation

A two-dimensional structure used to hold related information, also known as a
table.
Note

Most of Scott's employees were hired away from one of his previous employers, some
of whom have over 20 years of experience in the field. As a hiring incentive, Scott has agreed to
keep the new employees' original hire date in the new database.
Row

A group of one or more data elements in a database table that describes a person,
place, or thing.
Column

The component of a database table that contains all of the data of the same name
and type across all rows.
You'll learn about database design in the following sections, but let's assume for the moment
that the majority of the database design is completed and some tables need to be implemented.
Scott creates the EMP table to hold the basic employee information, and it looks something like
this:

 

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7902 FORD ANALYST 7566 03-DEC-81 3000 20

 

Notice that some fields in the Commission (COMM) and Manager (MGR) columns do not
contain a value; they are blank. A relational database can enforce the rule that fields in a column
may or may not be empty. [3]In this case, it makes sense for an employee who is not in the Sales
department to have a blank Commission field. It also makes sense for the president of the
company to have a blank Manager field, since that employee doesn't report to anyone.

Field

The smallest piece of information that can be retrieved by the database query
language. A field is found at the intersection of a row and a column in a database table.
On the other hand, none of the fields in the Employee Number (EMPNO) column are blank.
The company always wants to assign an employee number to an employee, and that number must
be different for each employee. One of the features of a relational database is that it can ensure
that a value is entered into this column and that it is unique. The EMPNO column, in this case, is
the primary key of the table.
Primary Key

A column (or columns) in a table that makes the row in the table
distinguishable from every other row in the same table.
Notice the different datatypes that are stored in the EMP table: numeric values, character or

alphabetic values, and date values.
As you might suspect, the DEPTNO column contains the department number for the
employee. But how do you know what department name is associated with what number?
Scott created the DEPT table to hold the descriptions for the department codes in the EMP
table.
The DEPTNO column in the EMP table contains the same values as the DEPTNO column
in the DEPT table. In this case, the DEPTNO column in the EMP table is considered a foreign
key to the same column in the DEPT table.
A foreign key enforces the concept of referential integrity in a relational database. [4]The
concept of referential integrity not only prevents an invalid department number from being
inserted into the EMP table, but it also prevents a row in the DEPT table from being deleted if
there are employees still assigned to that department.
Foreign Key

A column (or columns) in a table that draws its values from a primary or
unique key column in another table. A foreign key assists in ensuring the data integrity of a table.
Referential Integrity

A method employed by a relational database system that enforces
one-to-many relationships between tables.

Before Scott created the actual tables in the database, he went through a design process known
as data modeling. In this process, the developer conceptualizes and documents all the tables for the
database. One of the common methods for modeling a database is called ERA, which stands for
entities, relationships, and attributes. The database designer uses an application that can maintain
entities, their attributes, and their relationships. In general, an entity corresponds to a table in the
database, and the attributes of the entity correspond to columns of the table.
Data ModelingA process of defining the entities, attributes, and relationships between the
entities in preparation for creating the physical database.
The data-modeling process involves defining the entities, defining the relationships between
those entities, and then defining the attributes for each of the entities. Once a cycle is complete, it
is repeated as many times as necessary to ensure that the designer is capturing what is important
enough to go into the database. Let's take a closer look at each step in the data-modeling process.

 

First, the designer identifies all of the entities within the scope of the database application.
The entities are the persons, places, or things that are important to the organization and need to be
tracked in the database. Entities will most likely translate neatly to database tables. For example,
for the first version of Scott's widget company database, he identifies four entities: employees,
departments, salary grades, and bonuses. These will become the EMP, DEPT, SALGRADE, and
BONUS tables.

Once the entities are defined, the designer can proceed with defining how each of the
entities is related. Often, the designer will pair each entity with every other entity and ask, "Is
there a relationship between these two entities?" Some relationships are obvious; some are not.
In the widget company database, there is most likely a relationship between EMP and DEPT,
but depending on the business rules, it is unlikely that the DEPT and SALGRADE entities are
related. If the business rules were to restrict certain salary grades to certain departments, there
would most likely be a new entity that defines the relationship between salary grades and
departments. This entity would be known as an associative or intersection table and would
contain the valid combinations of salary grades and departments.
Associative Table

A database table that stores the valid combinations of rows from two
other tables and usually enforces a business rule. An associative table resolves a many-to-many
relationship.
In general, there are three types of relationships in a relational database:
One-to-many

The most common type of relationship is one-to-many. This means that
for each occurrence in a given entity, the parent entity, there may be one or more
occurrences in a second entity, the child entity, to which it is related. For example, in the
widget company database, the DEPT entity is a parent entity, and for each department,
there could be one or more employees associated with that department. The relationship
between DEPT and EMP is one-to-many.
One-to-one

In a one-to-one relationship, a row in a table is related to only one or none
of the rows in a second table. This relationship type is often used for subtyping. For
example, an EMPLOYEE table may hold the information common to all employees,
while the FULLTIME, PARTTIME, and CONTRACTOR tables hold information unique
to full-time employees, part-time employees, and contractors, respectively. These entities
would be considered subtypes of an EMPLOYEE and maintain a one-to-one relationship
with the EMPLOYEE table. These relationships are not as common as one-to-many
relationships, because if one entity has an occurrence for a corresponding row in another
entity, in most cases, the attributes from both entities should be in a single entity.
Many-to-many

In a many-to-many relationship, one row of a table may be related to
many rows of another table, and vice versa. Usually, when this relationship is

implemented in the database, a third entity is defined as an intersection table to contain
the associations between the two entities in the relationship. For example, in a database
used for school class enrollment, the STUDENT table has a many-to-many relationship
with the CLASS table—one student may take one or more classes, and a given class may
have one or more students. The intersection table STUDENT_CLASS would contain the
combinations of STUDENT and CLASS to track which students are in which classes.

Once the designer has defined the entity relationships, the next step is to assign the attributes
to each entity. This is physically implemented using columns, as shown here for the SALGRADE
table as derived from the salary grade entity.

After the entities, relationships, and attributes have been defined,
the designer may iterate the data modeling many more times. When
reviewing relationships, new entities may be discovered. For example,
when discussing the widget inventory table and its relationship to a
customer order, the need for a shipping restrictions table may arise.
Once the design process is complete, the physical database
tables may be created. [5]Logical database design sessions should not
involve physical implementation issues, but once the design has gone through an iteration or two,
it's the DBA's job to bring the designers "down to earth." As a result, the design may need to be
revisited to balance the ideal database implementation versus the realities of budgets and schedules.

1, leverage  ['li:vəridʒ, 'le-]
n. 手段,影响力;杠杆作用;杠杆效率

2, correlate  ['kɔ:rə,leit]
vi. 关联
vt. 使有相互关系;互相有关系
n. 相关物;相关联的人
adj. 关联的
3, essentially  [i'senʃəli]
adv. 本质上;本来
4, hypothetical  [,haipəu'θetikəl]
adj. 假设的;爱猜想的
5, entrepreneur  [,ɔntrəprə'nə:]
n. 企业家
6, incentive  [in'sentiv]
a. 刺激的,鼓励的
n. 刺激,鼓励,动机
7, integrity  [in'teɡrəti]
n. 完整;正直;诚实;廉正
8, associative 
a. 联合的(相关的,协会的)

Continue reading it-e-34 Structure of the Relational Database

jquery实用插件

jquery插件很多,但是适合你的不一定多,有的太酷有的太土,下面我来记录一下我认为比较实用的:

图片类:

1:图片浏览滚动 http://sorgalla.com/projects/jcarousel/ 

特点:文档详细,有demo

Snap1 Snap2

2: 图片浏览 http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html

Snap3

特点:简单实用

3: 图片浏览滚动 http://www.gcmingati.net/wordpress/wp-content/lab/jquery/svwt/index.html

第2个的高级版本

Snap4

4: tab页 idTabs http://kazge.com/archives/849.html

Continue reading jquery实用插件

hibernate连接一个数据库服务器中多个数据库

网上问的大多数是不同服务器不同表结构的方法,也碰到类似我这样的同一数据库服务器不同数据库但是表结构是一样的情况,

这篇文章http://hi.baidu.com/piaokes/blog/item/c715114ecbcdf7ced1c86a92.html的方法是传入数据库名创建对应的SessionFactory。

这样的情况,同表结构不同数据库的情形是多个同逻辑的子程序。子程序可能很多,每个都建个SessionFactory以及一系列的对象,性能是很吃力地吧。

hibernate自定义数据源:

http://www.ibm.com/developerworks/cn/opensource/os-hibernate/ 

但这是与集群相关,与逻辑无关。

看看自动生成的HibernateSessionFactory这个类,再看看org.hibernate.SessionFactory这个类的接口,再想想hibernate的目标,为每个数据库建立一个connection是行不通的。

我觉得这种情况是不适合使用ORM的。还是自己使用jdbc处理比较好。

 

最后想了想,还是应该分表而不是分库。但是这样hibernate还是无法处理。

Continue reading hibernate连接一个数据库服务器中多个数据库

初识PostgreSQL

今天偶然看到PostgreSQL的教科书文章 ,老早就听说过它了,这次觉得还比较强大啊,看这几篇文章:

为什么选用PostgreSQL,而不是Oracle?

http://www.cublog.cn/u/17549/showart_175035.html

PostgreSQL介绍

http://blog.csdn.net/daichadongqing/archive/2010/01/13/5184588.aspx

评论MySQL和PostgreSQL两类数据库的优点与缺点

http://blog.csdn.net/arau_sh/archive/2010/06/13/5670030.aspx

吸引我眼球的的是:免费,支持面向对象,支持多种语言编程。有空看看……

Continue reading 初识PostgreSQL

it-e-33 PostgreSQL

PostgreSQL is an object-relational database management system (ORDBMS) based on
POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer
Science Department. POSTGRES pioneered many concepts that only became available in some
commercial database systems much later.
Features PostgreSQL is an open-source descendant of this original Berkeley code. It
supports SQL92 and SQL99 and offers many modern features:
complex queries
foreign keys
triggers
views
transactional integrity
multiversion concurrency control
Additionally, PostgreSQL can be extended by the user in many ways, for exampleby
adding new

data types
functions
operators
aggregate functions
index methods
procedural languages
And because of the liberal license, PostgreSQL can be used, modified, and distributed by
everyone free of charge for any purpose, be it private, commercial, or academic.

Advantages PostgreSQL offers many advantages for your company or business over other
database systems.
1) Immunity to over-deployment
Over-deployment is what some proprietary database vendors regard as their #1 licence
compliance problem. With PostgreSQL, no-one can sue you for breaking licensing agreements,
as there is no associated licensing cost for the software.
This has several additional advantages:
More profitable business models with wide-scale deployment.
No possibility of being audited for license compliance at any stage.
Flexibility to do concept research and trial deployments without needing to include
additional licensing costs.
2) Better support than the proprietary vendors
In addition to our strong support offerings, we have a vibrant community of PostgreSQL
professionals and enthusiasts that your staff can draw upon and contribute to.
3) Significant saving on staffing costs
Our software has been designed and created to have much lower maintenance and tuning
requirements than the leading proprietary databases, yet still retain all of the features, stability,
and performance.
In addition to this our training programs are generally regarded as being far more cost
effective, manageable, and practical in the real world than that of the leading proprietary database
vendors.
4) Legendary reliability and stability
Unlike many proprietary databases, it is extremely common for companies to report that
PostgreSQL has never, ever crashed for them in several years of high activity operation. Not
even once. It just works.
5) Extensible
The source code is available to all at no charge. If your staff have a need to customise or
extend PostgreSQL in any way then they are able to do so with a minimum of effort, and with no
attached costs. This is complemented by the community of PostgreSQL professionals and
enthusiasts around the globe that also actively extend PostgreSQL on a daily basis.
6) Cross platform
PostgreSQL is available for almost every brand of Unix (34 platforms with the latest stable
release), and Windows compatibility is available via the Cygwin framework. Native Windows
compatibility is also available with version 8.0 and above.
7) Designed for high volume environments
We use a multiple row data storage strategy called MVCC to make PostgreSQL extremely
responsive in high volume environments. The leading proprietary database vendor uses this
technology as well, for the same reasons.
8) GUI database design and administration tools

Several high quality GUI tools exist to both administer the database (pgAdmin, pgAccess)
and do database design (Tora, Data Architect).

 

1, teller  ['telə]
n. (美)出纳员;讲述者;讲故事者;计票员

2, reservation  [,rezə'veiʃən]
n. 预约,预订;保留
3, at will 
随意;任意
4, pioneer  [,paiə'niə]
n. 先锋;拓荒者
vt. 开辟;倡导;提倡
vi. 作先驱

5, proprietary  [prə'praiətəri]
a. 专利的(所有的)
n. 所有权(所有人)

6, globe  [gləub]
n. 地球,地球仪,球体

7, volume  ['vɔlju:m; (US) -jəm]
n. 体积,容量,音量
n. 卷,册

Continue reading it-e-33 PostgreSQL

mongoDB 笔记

官网

http://www.mongodb.org

java driver下载:

https://github.com/mongodb/mongo-java-driver/downloads

 

先看

http://www.mongodb.org/display/DOCS/Quickstart

要在windows下安装为service,见

http://www.mongodb.org/display/DOCS/Windows+Service

具体命令是

mongod --port 13668 --logpath D:/mongodb-win32-i386-1.8.1/log/mongo.log --logappend --dbpath D:/mongodb-win32-i386-1.8.1/data --directoryperdb --serviceName MongoDb_181 –install

注意建议不要使用参数 --bind_ip 127.0.0.1 ,这样的话只能通过127.0.0.1来连接,使用局域网ip和localhost则不能连上

对应的删除命令是:

mongod --serviceName MongoDb_181  --remove

如果不需要作为服务,去掉上面的命令中的—install 和 --serviceName  参数即可

即:

mongod  --port 13668 --logpath D:/mongodb-win32-i386-1.8.1/log/mongo.log --logappend --dbpath D:/mongodb-win32-i386-1.8.1/data –directoryperdb

注意文档中有些问题:

--logpath 参数必须是个文件,不能是文件夹

--dbpath 所指向的文件夹必须已经存在,否则安装成功却启动不了,总是重复启动--失败

 

更多命令参数见    --help

突然看到这篇文章:

为什么我们放弃使用MongoDB

说的是比较实际的问题

32为系统文件大小限制,由于底层内存映射的实现造成的。

但是再看看

我为什么选择MongoDB

mongodb使用心得

想想,就当吃吃螃蟹吧。

具体我的体会等用过了再写。

对应的客户端命令则是mongo --port 13668

使用help查看帮助

使用db.help()查看db操作帮助

use 命令可切换到指定数据库,不存在的话就会创建一个,但不是马上创建,而是在插入数据时创建。

使用db.addUser添加用户到某个数据库,注意是指定的数据库,其他的数据库是不存在这个用户的.

关于权限管理可参见 http://blog.csdn.net/a9529lty/archive/2011/05/31/6457279.aspx

 

验证的顺序也是一样,先转到某个数据库,再验证用户。

参见这篇文章快速入门http://blog.sina.com.cn/s/blog_661b4cd50100h8zk.html

使用java 见http://www.mongodb.org/display/DOCS/Java+Tutorial

它的依赖很简单,只要添加驱动依赖包就可以say hello world!了:

>public class HelloWorls { public HelloWorls() { } public static void main(String[] args) { try { Mongo m = new Mongo( "192.168.666.666" , 13668 );

Continue reading mongoDB 笔记

Pagination


Total views.

© 2013 - 2019. All rights reserved.

Powered by Hydejack v6.6.1