13 Aralık 2018

https://netbeans.org/kb/docs/ide/java-db.html

https://netbeans.org/kb/docs/ide/java-db.html

Working with the Java DB (Derby) Database

This document demonstrates how to set up a connection to Java DB database in NetBeans IDE. Once a connection is made, you can begin working with the database in the IDE, allowing you to create tables, populate them with data, run SQL statements and queries, and more.
The Java DB database is Sun's supported distribution of Apache Derby. Java DB is a fully transactional, secure, standards-based database server, written entirely in Java, and fully supports SQL, JDBC API, and Java EE technology. The Java DB database is packaged with the GlassFishapplication server, and is included in JDK 6 as well. For more information on Java DB database, consult the official documentation.
Contents
Content on this page applies to NetBeans IDE 7.2, 7.3, 7.4 and 8.0
To follow this tutorial, you need the following software and resources.
Software or ResourceVersion Required
NetBeans IDE7.2, 7.3, 7.4, 8.0, Java EE
Java Development Kit (JDK)Version 7 or 8
Java DBversion 10.4.x, 10.5.x
Note.
  • Java DB is installed when you install JDK 7 or JDK 8 (except on Mac OS X). If you are using Mac OS X you can download and installJava DB manually or use the Java DB that is installed by Java EE version of the NetBeans IDE installer.

Configuring the Database

If you have the GlassFish Server registered in your NetBeans IDE installation, Java DB will already be registered for you. Therefore, you can skip ahead to Starting the Server and Creating a Database.
If you downloaded the GlassFish server separately and need help registering it in NetBeans IDE, see Registering a GlassFish Server Instancein the IDE's Help Contents (F1).
If you just downloaded Java DB on its own, perform the following steps.
  1. Run the self-extracting file. A folder named 'javadb' will be created in the same location as the file. If you just downloaded Java DB and want to have the database server reside in a different location than where it was extracted to, you should relocate it now.
  2. On your system, create a new directory to be used as a home directory for the individual instances of the database server. For example, you can create this folder in the Java DB root directory (javadb) or in any other location.
Before continuing further, it is important to understand the components found in Java DB's root directory:
  • The demo subdirectory contains the demonstration programs.
  • The bin subdirectory contains the scripts for executing utilities and setting up the environment.
  • The javadoc subdirectory contains the API documentation that was generated from source code comments.
  • The docs subdirectory contains the Java DB documentation.
  • The lib subdirectory contains the Java DB jar files.

Registering the Database in NetBeans IDE

Now that the database is configured, perform the following steps to register Java DB in the IDE.
  1. In the Services window, right-click the Java DB Database node and choose Properties to open the Java DB Settings dialog box.
  2. For the Java DB Installation text field, enter the path to the Java DB root directory (javadb) that you specified in the previous step.
  3. For Database Location, use the default location if a location is already provided. Click OK
    For example, the default location might look like C:\Documents and Settings\username\.netbeans-derby on a Windows machine.
    Java DB settings dialog
    Note. If the Database Location field is empty you will need to set the path to the directory that contains your databases. You will need to create a directory for the databases if no directory exists.

Starting the Server and Creating a Database

The Java DB Database menu options are displayed when you right-click the Java DB node in the Services window. This contextual menu items allow you to start and stop the database server, create a new database instance, as well as register database servers in the IDE (as demonstrated in the previous step). To start the database server:
  1. In the Services window, right-click the Java DB node and choose Start Server. Note the following output in the Output window, indicating that the server has started:
    Output window display after starting the database server
  2. Right-click the Java DB node and choose Create Database to open the Create Java DB Database dialog.
  3. Type contact for the Database Name.
  4. Type nbuser for the User Name and Password. Click OK.
    Create Java DB Database dialog
    Note. The Database Location is the default location set during installation of Java DB from GlassFish. If you installed Java DB separately, this location might be different.

After you create the database, if you expand the Databases node in the Services window you can see that the IDE created a database connection and that the database was added to the list under the Java DB node.

03 Aralık 2018

https://www.cs.sfu.ca/CourseCentral/354/zaiane/material/postscript/Chapter2.pdf

 Attributes
It is possible to de ne a set of entities and the relationships among them in a number of di erent ways. The main difference is in how we deal with attributes.
Consider the entity set employee with attributes employee-name and phone-number.
We could argue that the phone be treated as an entity itself, with attributes phone-number and location.
Then we have two entity sets, and the relationship set EmpPhn de ning the association between employees and their phones.
This new de nition allows employees to have several (or zero) phones.
New de nition may more accurately re ect the real world.

Mapping Cardinalities: express the number of entities to which another entity can be associated via a relationship. For binary relationship sets between entity sets A and B, the mapping cardinality must be one of:
1. One-to-one: An entity in A is associated with at most one entity in B, and an entity in B is associated with at most one entity in A. (Figure 2.3)
2. One-to-many: An entity in A is associated with any number in B. An entity in B is associated with at most one entity in A. (Figure 2.4)
3. Many-to-one: An entity in A is associated with at most one entity in B. An entity in B is associated with any number in A. (Figure 2.5)
4. Many-to-many: Entities in A and B are associated with any number from each other.

Existence Dependencies:
if the existence of entity X depends on the existence of entity Y, then X is said to be existence dependent on Y.
(Or we say that Y is the dominant entity and X is the subordinate entity.)
For example,
{ Consider account and transaction entity sets, and a relationship log between them.
{ This is one-to-many from account to transaction.
{ If an account entity is deleted, its associated transaction entities must also be deleted.
{ Thus account is dominant and transaction is subordinate.

05 Kasım 2018

Definition - What does Tuple (Database) mean?
In the context of relational databases, a tuple is one record (one row). The information in a database can be thought of as a spreadsheet, with columns (known as fields or attributes) representing different categories of information, and tuples (rows) representing all the information from each field associated with a single record.

Tanım - Tuple (Veritabanı) ne anlama geliyor?
İlişkisel veritabanları bağlamında, bir tuple bir kayıttır (bir satır). Veritabanındaki bilgiler, farklı bilgi kategorilerini temsil eden sütunlar (alanlar veya özellikler olarak bilinir) ve tek bir kayıtla ilişkilendirilen her alandan tüm bilgileri temsil eden tupler (satırlar) ile birlikte bir elektronik tablo olarak düşünülebilir.
A relationship is an association among two or more entities.

For example, we may have the relationship that Attishoo works in the pharmacy department.

As with entities, we may wish to collect a set of similar relationships into a relationship set. A relationship set can be thought of as a set of n-tuples.

Each n-tuple denotes a relationship involving n entities e1 through en, where entity ei is in entity set Ei.
In Figure 2.2 we show the relationship set Works_In, in which each relationship indicates a department in which an employee works. Note that several relationship sets might involve the same entity sets. For example, we could also have a Manages relationship set involving Employees and Departments.

A relationship can also have descriptive attributes. Descriptive attributes are used to record information about the relationship, rather than about any one of the participating entities; for example, we may wish to record that At- tishoo works in the pharmacy department as of January 1991.

Bir ilişki, iki veya daha fazla varlık arasındaki ortaklıktır..

Örneğin, Attishoo'nun eczane bölümünde çalıştığı ilişkiye sahip olabiliriz.

Varlıklarda olduğu gibi, bir ilişki kümesine, benzer ilişkileri toplamak isteyebiliriz. Bir ilişki seti n-tuples kümesi olarak düşünülebilir.

Her bir n-tuple, varlık ei nin, varlık kümesi Ei içinde yer alan,
e1 den en'e kadar n tane varlığı kapsayan bir ilişkiyi ifade eder.

Şekil 2.2'de, her bir ilişkinin bir çalışanın çalıştığı bir departmanı belirttiği Works_In ilişkisini gösteriyoruz. Birkaç ilişki kümesinin aynı varlık kümelerini içerebileceğini unutmayın. Örneğin, Çalışanları ve Bölümleri içeren bir Yöneten ilişki kümesine sahip olabiliriz.

Bir ilişki de tanımlayıcı özelliklere sahip olabilir. Tanımlayıcı özellikler ilişki hakkında bilgi kaydetmek için kullanılır,  örneğin, Attishoo’nun Ocak 1991’den itibaren eczane departmanında çalıştığını kayıt edebiliriz..

22 Ekim 2018

Entities attributes, and entity sets (22 Ekim 2018)
An entity is an object in the real world that is distinguishable from other objects. Examples include the following: the Green Dragonzord toy, the toy department, the manager of the toy department, the home address of the manager of the toy department. It is often useful to identify a collection of similar entities. Such a collection is called an entity set. Note that entity sets need not be disjoint; the collection of toy department employees and the collection of appliance department employees may both contain employee John Doe (who happens to work in both departments). We could also define an entity set called Employees that contains both the toy and appliance department employee sets.
An entity is described using a set of attributes. All entities in a given entity set have the same attributes; this is what we mean by similar. (This statement is an oversimplification, as we will see when we discuss inheritance hierarchies in Section 2.4.4, but it suffices for now and highlights the main idea.) Our choice of attributes reflects the level of detail at which we wish to represent information about entities. For example, the Employees entity set could use name, social security number (ssn), and parking lot (lot) as attributes. In this case we will store the name, social security number, and lot number for each employee. However, we will not store, say, an employee's address (or gender or age).
For each attribute associated with an entity set, we must identify a domain of possible values. For example, the domain associated with the attribute name of Employees might be the set of 20-character strings.1 As another example, if the company rates employees on a scale of 1 to 10 and stores ratings in a field called mting, the associated domain consists of integers 1 through 10. Further, for each entity set, we choose a key. A key is a minimal set of attributes whose values uniquely identify an entity in the set. There could be more than one candidate key; if so, we designate one of them as the primary key. For now we assume that each entity set contains at least one set of attributes that uniquely identifies an entity in the entity set; that is, the set of attributes contains a key. We revisit this point in Section 2.4.3.
The Employees entity set with attributes ssn, name, and lot is shown in Figure 2.1. An entity set is represented by a rectangle, and an attribute is represented by an oval. Each attribute in the primary key is underlined. The domain information could be listed along with the attribute name, but we omit this to keep the figures compact. The key is s.m.


Varlıklar, özellikler ve varlık kümeleri
Bir varlık, gerçek dünyada diğer nesnelerden ayırt edilebilen bir nesnedir. Örnekler arasında şunlar sayılabilir: Yeşil Dragonzord oyuncağı, oyuncak bölümü, oyuncak departmanının yöneticisi, oyuncak departmanının yöneticisinin ev adresi. Benzer varlıklar koleksiyonunu tanımlamak genellikle yararlıdır. Böyle bir koleksiyon bir varlık kümesi olarak adlandırılır. Varlık kümelerinin ayrılmaya ihtiyaç duymadığını unutmayın; oyuncak departmanı çalışanları topluluğu ve cihaz departmanı çalışanları topluluğunun her ikisi de çalışan John Doe'yu (her iki bölümde de görev yapan) içerebilir. Ayrıca, hem oyuncak hem de cihaz bölümü çalışan kümelerini içeren Çalışanlar adı verilen bir varlık grubu tanımlayabiliriz.
Bir varlık, bir dizi özellik kullanılarak tanımlanır. Belirli bir varlık kümesindeki tüm varlıklar aynı özelliklere sahiptir; benzer demekle kastettiğimiz budur. (Bu ifade, Bölüm 2.4.4'teki miras hiyerarşilerini ele aldığımızda göreceğimiz gibi, bir aşırı basitleştirmedir, ancak şu an için yeterlidir ve ana fikri vurgular.) Seçtiğimiz özellikler, varlıklar hakkındaki bilgiyi temsil etmek istediğimiz ayrıntı düzeyini yansıtır. Örneğin, çalışanlar kümesi, ad, sosyal güvenlik numarası (ssn) ve otopark hissesi (lot) özellik olarak kullanabilir. Bu durumda, her çalışan için adı, sosyal güvenlik numarası ve park yeri numarasını kayıtedeceğiz. Ancak, çalışanın adresini (veya cinsiyetini veya yaşını) saklamayız.
Bir varlık kümesi ile  ilişkilendirilmiş her bir özellik için, olası değerlerin bir domain(etki alanı) ini tanımlamalıyız. Örneğin, Çalışanların adı özelliği ile ilişkilendirilen etki alanı, 20 karakterlik string olabilir. Başka bir örnek olarak, şirket çalışanlarını 1 ile 10 arasında bir ölçekte derecelendirir ve mting olarak adlandırılan bir alanda derecelendirmeleri saklarsa,  ilgili etki alanı (domain) 1'den 10'a kadar olan tam sayılardan oluşur. Dahası, her varlık kümesi için bir anahtar seçeriz. Bir anahtar, değerleri kümedeki bir varlığı benzersiz olarak tanımlayan minimum özellik kümesidir. Birden fazla aday anahtarı olabilir; eğer öyleyse, bunlardan birini birincil anahtar olarak belirleriz. Şimdilik, her varlık kümesinin, varlık kümesindeki bir varlığı benzersiz olarak tanımlayan en az bir özellik kümesi içerdiğini varsayalım; Yani, özellikler kümesi bir anahtar içerir. Bu noktayı Bölüm 2.4.3'te yeniden ele alacağız.
Özellikler ssn, isim ve lot ile belirlenen çalışanlar, Şekil 2.1'de gösterilmiştir. Varlık kümesi bir dikdörtgenle temsil edilir ve bir özellik bir elips  ile temsil edilir. Birincil anahtardaki her bir özelliğin altı çizilir. Etki alanı bilgisi, özellik adıyla birlikte listelenebilir, ancak bu rakamları kompakt tutmak için bunu çıkarırız. Anahtar s.m. dir
The great successful men of the world have used their imaginations. They think ahead and create their mental picture. and then go to work materializing that picture in all its details, filling in here, adding a little there, altering this bit and that bit, but steadily building, steadily building.
Robert Collier
Dünyanın büyük başarılı adamları hayal güçlerini kullandılar.
İleriyi düşünürler ve düşencelerindeki resmi yaratırlar.
ve sonra tüm detaylarda bu resmi hayata geçirmek için çalışırlar.
beriyi doldururlar, biraz öteye eklerler ve bit bit değiştirirler
ama kararlı bir şekilde inşaa ederler, sürekli inşaa ederler.

15 Ekim 2018

Data Administration: 
When several users share the data, centralizing the administration of data can offer significant improvements. Experienced professionals who understand the nature of the data being managed, and how different groups of users use it, can be responsible for organizing the data representation to minimize redundancy and for fine-tuning the storage of the data to make retrieval efficient.

08 Ekim 2018

ADVANTAGES OF A DBMS

ADVANTAGES OF A DBMS
Using a DBMS to manage data has many advantages:
I
Data Independence: Application programs should not, ideally, be exposed to details of data representation and storage, The DBMS provides an abstract view of the data that hides such details.
Veri Bağımsızlığı:
Uygulama programları ideal olarak veri temsili ve depolama ayrıntılarına maruz bırakılmamalıdır.
DBMS, bu ayrıntıları saklayan verilerin soyut bir görünümünü sağlar.
II
Efficient Data Access: A DBMS utilizes a variety of sophisticated techniques to store and retrieve data efficiently. This feature is especially important if the data is stored on external storage devices.
Verimli Veri Erişimi:
Bir DBMS, verileri verimli bir şekilde depolamak ve almak için çeşitli karmaşık teknikler kullanır. Bu özellik, veriler harici depolama cihazlarında saklanırsa özellikle önemlidir.
II
Data Integrity and Security: If data is always accessed through the DBMS, the DBMS can enforce integrity constraints. For example, before inserting salary information for an employee, the DBMS can check that the department budget is not exceeded. Also, it can enforce access controls that govern what data is visible to different classes of users.
Veri Bütünlüğü ve Güvenlik: Verilere her zaman DBMS aracılığıyla erişilirse, DBMS bütünlük kısıtlamalarını uygulayabilir. Örneğin, bir çalışan için maaş bilgilerini eklemeden önce, DBMS departman bütçesinin aşılmadığını kontrol edebilir. Ayrıca, farklı kullanıcı sınıflarına hangi verilerin görülebileceğini yöneten erişim kontrollerini de uygulayabilir.
II
Data Administration: When several users share the data, centralizing the administration of data can offer significant improvements. Experienced professionals who understand the nature of the data being managed, and how different groups of users use it, can be responsible for organizing the data representation to minimize redundancy and for fine-tuning the storage of the data to make retrieval efficient.
Veri Yönetimi :
Birkaç kullanıcı verileri paylaştığında,
veri yönetimini merkezileştirmek önemli gelişmeler sağlayabilir.
Yönetilen verilerin doğasını ve farklı kullanıcı gruplarının bunu
nasıl kullandığını anlayan deneyimli profesyoneller,
veri fazlalığı en aza indirmek için veri sunumunu organize etmekten
ve
verilerin verimli bir şekilde geri çağırılması için depolamanın
ince ayarından sorumlu olabilirler.
II
 Concurrent Access and Crash Recovery: A DBMS schedules concurrent accesses to the data in such a manner that users can think of the data as being accessed by only one user at a time. Further, the DBMS protects users from the effects of system failures.
II
Reduced Application Development Time: Clearly, the DBMS supports important functions that are common to many applications accessing data in the DBMS. This, in conjunction with the high-level interface to the data, facilitates quick application development. DBMS applications are also likely to be more robust than similar stand-alone applications because many important tasks are handled by the DBMS (and do not have to be debugged and tested in the application).
A database is a collection of data, typically describing the activities of one or more related organizations. For example, a university database might contain information about the following:
• Entities such as students, faculty, courses, and classrooms.
• Relationships between entities, such as students' enrollment in courses, faculty teaching courses, and the use of rooms for courses.
A database management system, or DBMS, is software designed to assist in maintaining and utilizing large collections ofdata. The need for such systems, as well as their use, is growing rapidly. The alternative to using a DBMS is to store the data in files and write application-specific code to manage it. The use of a DBMS has several important advantages, as we will see in Section 1.4.

Veri tabanı bir veri topluluğudur.
  Bir veya daha fazla ilgili kuruluşun faaliyetlerini tipik olarak açıklar.

  Örneğin, bir üniversite veri tabanı aşağıdakiler hakkında bilgi içerebilir:
• Öğrenciler, öğretim üyeleri, dersler ve sınıflar gibi varlıklar.

• Varlıklar arasındaki ilişkiler,
Öğrenciler derslere kayıt, fakülte öğretim kursları ve dersler için oda kullanımı gibi.

Bir veritabanı yönetim sistemi veya DBMS, büyük veri koleksiyonlarını
bakımına ve kullanımına yardımcı olmak için tasarlanmış bir
yazılımdır.
Bu tür sistemlere olan ihtiyaç,
hem de kullanımı hızla büyüyor.
Bir DBMS kullanmanın alternatifi, verileri dosyalarda saklamak ve yönetmek için uygulamaya özel kod yazmaktır. DBMS'nin kullanımı, Bölüm 1.4'te göreceğimiz gibi, bazı önemli avantajlara sahiptir.