Archive for the ‘Database’ Category

Oracle Database Structure

Posted: May 12, 2010 in Database
Tags: ,


Each running Oracle database is associated with an Oracle instance. When a database is started on a database server, the Oracle software allocates a shared memory area called the System Global Area (SGA) and starts several Oracle background processes. This combination of the SGA and the Oracle processes is called an Oracle instance.
After starting an instance, the Oracle software associates the instance with a specific database. This is called mounting the database. The database is then ready to be opened, which makes it accessible to authorized users. Multiple instances can execute concurrently on the same computer, each accessing its own physical database.
You can look at the Oracle database architecture as various interrelated structural components.
An Oracle database uses memory structures and processes to manage and access the database. All memory structures exist in the main memory of the computers that constitute the database server. Processes are jobs that work in the memory of these computers. A process is defined as a “thread of control” or a mechanism in an operating system that can run a series of steps.

Creating an Oracle Database

Posted: April 25, 2010 in Database
Tags: ,

What we want to learn here is creating a database using Database Configuration Assistant. I created this tutorial as simple as possible :]

A standard installation can be completed on a computer with 1 GB of RAM and 1.5 GB of swap space or larger. Depending on the activity level of the machine on which you are installing the Oracle database software, the standard installation can complete in 20 minutes or less.

Oh yeah… i’m using Oracle 10g and Windows XP for installation

Database Configuration Window

(more…)

In this article, i will create a simple application that which implements NHibernate, in database side, i will use SQL Server 2008. What is NHibernate ? I will not explain it in there,  there are lot of explanations in the internet, like in here.

You can download latest NHibernate version here.

First, i will create a simple database that have just one table (and i added some record in there):

This is the DDL (Data Definition Language)

create table ACCOUNT (
   ACCID                int         identity(1,1)       not null,
   USERNAME             varchar(50)                     null,
   PASS                 varchar(50)                     null,
   constraint PK_ACCOUNT primary key nonclustered (ACCID)
)

Hmm.. what does this Identity(1,1)  mean ??? It is mean we will set ACCID attribute, the primary key, to become autonumbered, the value will be added automatically incrementing from 1, 2, 3, … and so on.

Next step, we will create simple solution in Visual Studio 2008 SP1 (remember … to connect to SQL Server 2008, your Visual Studio 2008 must be Service Pack 1 ).

Add some references

  1. NHibernate.dll (NHibernate library)
  2. NHibernate.ByteCode.LinFu.dll (for lazy loading)
  3. System.configuration

(more…)

Oracle Login Problem

Posted: February 20, 2010 in Database
Tags:

I got a little stupid thing when i want to login into my Oracle Server. here is the problem, i cannot open login page

Nah, after got some time, i found the the solution. When i restart my server, some of Oracle services stopped. A good way to solve this, set all of the Oracle services into “Automatic”

And then…problem solved (a simple solution for a simple problem…haha)

Database merupakan tempat penyimpanan data, yang memudahkan pengolahan dan pencarian data. SQL Server 2008 merupakan DBMS (Database Management System) yang powerfull untuk mengolah data. Di samping memiliki user interface yang mudah digunakan,. SQL Server 2008 juga memiliki fitur tambahan yang bisa diimplementasikan untuk meningkatkan performa dan mengurangi tempat penyimpanan

Berikut ini file tutorial instalasi SQL Server 2008 Enterprise yang saya buat :

< DONWLOAD TUTORIAL  (*.doc)>

< DONWLOAD TUTORIAL (*.pdf)>

SQL Function in Oracle

Posted: April 5, 2009 in Database
Tags: , ,

TOP

SQL Server:

SELECT TOP 10 product, descr, email
FROM products

ORACLE:

SELECT product, descr, email
FROM products
WHERE ROWNUM < = 10 [/sourcecode] MySQL: [sourcecode language='sql'] SELECT product, descr, email FROM products LIMIT 10 [/sourcecode]

Function for Query
ex : SELECT

        public DataSet ExecuteQuery(string sql)
        {
            DataSet dsResult = new DataSet();

            try
            {
                OracleDataAdapter daAdapter = new OracleDataAdapter(sql, conn);
                daAdapter.Fill(dsResult);
            }
            catch (OracleException oex)
            {
                if (oex.Number == 2292)
                    MessageBox.Show("crash from a data from other table");
                else
                    MessageBox.Show(oex.Message);

                CloseConnection();
                OpenConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

                CloseConnection();
                OpenConnection();
            }

            return dsResult;
        }

Function for DML
ex : UPDATE, DELETE


        public int ExecuteSQL(string sql)
        {
            int isAffectedRows = 0;

            try
            {
                OracleTransaction oTransaction = conn.BeginTransaction();
                OracleCommand oCmd = conn.CreateCommand();
                oCmd.CommandText = sql;
                isAffectedRows = oCmd.ExecuteNonQuery();
                oTransaction.Commit();
            }
            catch (OracleException oex)
            {
                if (oex.Number == 2292)
                {
                    MessageBox.Show("crash from a data from other table");
                }
                else
                {
                    MessageBox.Show(oex.Message);
                }

                CloseConnection();
                OpenConnection();

                return 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

                CloseConnection();
                OpenConnection();

                return 0;
            }

            return isAffectedRows;  // if success return value not 0
        }

CSV (Comma Separated Value)

Posted: March 23, 2009 in Database
Tags:

Definisi
Format CSV merupakan salah satu format yang digunakan dalam standar file ASCII. Format ini menggunakan tanda koma (,) sebagai pemisah antara satu elemen dengan yang lainnya.

(more…)

Referential Integrity Constraint

Posted: March 23, 2009 in Database
Tags:

Referential Integrity Constraint digunakan untuk menjaga konsistensi baris-baris data antara dua buah tabel. Aturan ini mengharuskan sebuah baris pada sebuah tabel yang terelasikan pada tabel lain harus mengacu pada sebuah baris di dalam tabel tersebut. Terdapat 2 macam tabel yaitu tabel child dan tabel parent. Aturan untuk referential integrity biasanya digunakan jika terjadi proses modifikasi data.

(more…)