Most operating systems provide program interfaces for performing operations involving the sending and receiving of data over sockets. Most operating systems also provide administrative capabilities to control the amount of memory allocated per socket that is used as data buffers.

ref : http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.nd.doc%2Finfo%2Fae%2Fae%2Ftrun_ha_cfg_socket.html

JerryCheng 發表在 痞客邦 留言(0) 人氣()

在database中 , 我們通常會需要設定一個key來做為每個紀錄的辨識 , 

而這樣的key , 我們就稱為Primary key.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

In Shell programming , we should use $(( )) if we want to do arithmetic operation.

for example :

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Sometimes , we may want to concantenate two string into one string.

It is simple in Shell programming , the example is as below:

JerryCheng 發表在 痞客邦 留言(0) 人氣()

First , we must connect to database by using root account.

# mysql -u root -p

JerryCheng 發表在 痞客邦 留言(0) 人氣()

修改Mysql的密碼 , 主要有以下兩個步驟 , 

1 . 連線Mysql

JerryCheng 發表在 痞客邦 留言(0) 人氣()

We also can insert records to the database by JDBC API.

For example : 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

How to create a table in the database by JDBC API?

The example is as below : 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

We should send a SQL command if we want the database do some operation.
For example :
//STEP 1. Import required packages
import java.sql.*;

public class JDBCExample {
   // JDBC driver name and database URL
   static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";  
   static final String DB_URL = "jdbc:mysql://localhost/";

   //  Database credentials
   static final String USER = "username";
   static final String PASS = "password";
   
   public static void main(String[] args) {
   Connection conn = null;
   Statement stmt = null;
   try{
      //STEP 2: Register JDBC driver
      Class.forName("com.mysql.jdbc.Driver");

      //STEP 3: Open a connection
      System.out.println("Connecting to database...");
      conn = DriverManager.getConnection(DB_URL, USER, PASS);

      //STEP 4: Execute a query
      System.out.println("Creating database...");
      stmt = conn.createStatement();
      
      String sql = "CREATE DATABASE STUDENTS";
      stmt.executeUpdate(sql);
      System.out.println("Database created successfully...");
   }catch(SQLException se){
      //Handle errors for JDBC
      se.printStackTrace();
   }catch(Exception e){
      //Handle errors for Class.forName
      e.printStackTrace();
   }finally{
      //finally block used to close resources
      try{
         if(stmt!=null)
            stmt.close();
      }catch(SQLException se2){
      }// nothing we can do
      try{
         if(conn!=null)
            conn.close();
      }catch(SQLException se){
         se.printStackTrace();
      }//end finally try
   }//end try
   System.out.println("Goodbye!");
}//end main
}//end JDBCExample

 

ref : http://www.tutorialspoint.com/jdbc/jdbc-create-database.htm

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Before we do any operation for database , we should know how to connect the Mysql database 

throuth JDBC.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

JDBC stands for Java DataBase Connectivity ,  it is a standard Java API (Application Programming Interface)

for database-independent connectivity between the Java programming language and a wide range of databases.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

When we use vector class , we can use for-each to iterate all elements in the vector container.

import java.util.*; 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

We can Enumeration class to iterate the element of Hashtable.

 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Exceptions in C++ are implemented using three keywords that work in conjunction with each other: throwtry, and catch.


JerryCheng 發表在 痞客邦 留言(0) 人氣()

virtual function is a special type of function that resolves to the 
most-derived version of the function with the same signature.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

In programming languages, polymorphism means that some code or operations or objects behave differently in different contexts.

For example, the + (plus) operator in C++:

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Code written in-place is significantly faster , so C++ offers a way to combine the advantages of functions 

with the speed of code written in-place: inline functions.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

We can read a line by using getline function.

There are two situation , we know the size of a line , or 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

A template expression parameter is a parameter that does not substitute for a type, 

but is instead replaced by a value.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Template class is similar to function template , 

We can use the template to instead of type of variable or method of class.

JerryCheng 發表在 痞客邦 留言(0) 人氣()