Feeds:
Posts
Comments

 

Dedicated Servers Shared Servers Database Resident Connection Pooling

When a client request is received, a new server process and a session are created for the client.

When the first request is received from a client, the Dispatcher process places this request on a common queue. The request is picked up by an available shared server process. The Dispatcher process then manages the communication between the client and the shared server process.

When the first request is received from a client, the Connection Broker picks an available pooled server and hands off the client connection to the pooled server.

If no pooled servers are available, the Connection Broker creates one. If the pool has reached its maximum size, the client request is placed on the wait queue until a pooled server is available.

Releasing database resources involves terminating the session and server process.

Releasing database resources involves terminating the session.

Releasing database resources involves releasing the pooled server to the pool.

Memory requirement is proportional to the number of server processes and sessions. There is one server and one session for each client.

Memory requirement is proportional to the sum of the shared servers and sessions. There is one session for each client.

Memory requirement is proportional to the number of pooled servers and their sessions. There is one session for each pooled server.

Session memory is allocated from the PGA.

Session memory is allocated from the SGA.

Session memory is allocated from the PGA.

HTML has many predefined entities, but XML has only five predefined entities:

  • & (& or “ampersand”)
  • &lt; (< or “less than”)
  • &gt; (> or “greater than”)
  • &apos; (‘ or “apostrophe”)
  • &quot; (” or “quotation mark”)

“ ” is the decimal form of “&nbsp;” which represents a “Non-Breaking Space” in HTML/XHTML, whilst “ ” is the hexadecimal form.

“ ”  or “ ” definitely works in both HTML and XML. 

 

Ref:

What is JDBC and what is it used for?

JDBC is a set of classes and interfaces written in Java to allow other Java programs to send SQL statements to a relational database management system.Oracle provides three categories of JDBC drivers:

  • JDBC Thin Driver (No local Net8 installation required/ handy for applets)
  • JDBC OCI for writing stand-alone Java applications
  • JDBC KPRB driver (default connection) for Java Stored Procedures and Database JSP’s.

Oracle’s JDBC Thin driver uses Java sockets to connect directly to Oracle. It provides its own TCP/IP version of Oracle’s Net8 (SQL*Net) protocol. Because it is 100% Java, this driver is platform independent and can also run from a Web Browser (applets).

Oracle’s JDBC OCI drivers uses Oracle OCI (Oracle Call Interface) to interact with an Oracle database. You must use a JDBC OCI driver appropriate to your Oracle client installation. The OCI driver works through either SQL*Net or Net8.

  • JDBC OCI7 works with an Oracle7 client.
  • JDBC OCI8 works with an Oracle8 client.

Either of these client versions can access Oracle7 or Oracle8 servers.The JDBC OCI drivers allow you to call the OCI directly from Java, thereby providing a high degree of compatibility with a specific Version of Oracle. Because they use native methods, they are platform specific.

Oracle’s JDBC KBPR driver is mainly used for writing Java stored procedures, triggers and database JSPs. It uses the default/ current database session and thus requires no additional database username, password or URL.All three drivers support the same syntax and API’s. Oracle needs three drivers to support different deployment options. Looking at source code, they will only differ in the way you connect to the database. Remember, you must use a JDBC version that matches the version of your Java Development Kit.

How does one connect with the JDBC Thin Driver?

The JDBC thin driver provides the only way to access Oracle from the Web (applets). It is smaller and faster than the OCI drivers, and doesn’t require a pre-installed version of the JDBC drivers.

import java.sql.*;

class dbAccess {
  public static void main (String args []) throws SQLException
  {
        DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

        Connection conn = DriverManager.getConnection
             (“jdbc:oracle:thin:@hostname:1526:orcl”, “scott”, “tiger”);
                             // @machineName:port:SID,   userid,  password

        Statement stmt = conn.createStatement();
        ResultSet rset = stmt.executeQuery(“select BANNER from SYS.V_$VERSION”);
        while (rset.next())
              System.out.println (rset.getString(1));   // Print col 1
        stmt.close();
  }
}

How does one connect with the JDBC OCI Driver?

One must have Net8 (SQL*Net) installed and working before attempting to use one of the OCI drivers.

import java.sql.*;

class dbAccess {
  public static void main (String args []) throws SQLException
  {
        try {
              Class.forName ("oracle.jdbc.driver.OracleDriver");
        } catch (ClassNotFoundException e) {
              e.printStackTrace();
        }

        Connection conn = DriverManager.getConnection
             ("jdbc:oracle:oci8:@hostname_orcl", "scott", "tiger");
                     // or oci7 @TNSNames_Entry,    userid,  password

        Statement stmt = conn.createStatement();
        ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
        while (rset.next())
              System.out.println (rset.getString(1));   // Print col 1
        stmt.close();
  }
}

How does one connect with the JDBC KPRB Driver?

One can obtain a handle to the default or current connection (KPRB driver) by calling the OracleDriver.defaultConenction() method. Please note that you do not need to specify a database URL, username or password as you are already connected to a database session. Remember not to close the default connection. Closing the default connection might throw an exception in future releases of Oracle. 

import java.sql.*;
class dbAccess {
  public static void main (String args []) throws SQLException
  {
        Connection conn = (new oracle.jdbc.driver.OracleDriver()).defaultConnection();

        Statement stmt = conn.createStatement();
        ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
        while (rset.next())
              System.out.println (rset.getString(1));   // Print col 1
        stmt.close();
  }
}

Ref: http://www.orafaq.com/faqjdbc.htm#JDBC

How to install the Oracle adapter 

This has been asked many times on rails-talk mailing list, so I want to summarize:
    sudo gem install activerecord-oracle-adapter –source http://gems.rubyonrails.org

(Since ActiveRecord Oracle Adapter is moving to Rubyforge. “–source http://gems.rubyonrails.org” will be omitted )
or check it out from svn:
    svn co http://svn.rubyonrails.org/rails/adapters/oracle/lib/active_record/connection_adapters/

And note that the adapter name specified in config/database.yml should be “oracle”, “oci” is deprecated.

Additional Info

Oracle “enhanced” ActiveRecord adapter is a fork of Rails Oracle Adapter, contains useful additional methods for working with new and legacy Oracle databases from Rails.

Ruby-OCI8 1.0.2 gem available, a big thanks to Kubo. I’m glad to have proposed this and made a little contribution.

To install Ruby-OCI8 via gem, follow these steps:

  1. su – root
  2. rpm -ivh oracle-instantclient-basic-11.1.0.1-1.rpm oracle-instantclient-devel-11.1.0.1-1.rpm    (download link; or install oracle full client)
  3. export LD_LIBRARY_PATH=/usr/lib/oracle/11.1.0.1/client/lib:$LD_LIBRARY_PATH
  4. cd /usr/lib/oracle/11.1.0.1/client/lib
  5. ln -s libclntsh.so.11.1 libclntsh.so
  6. gem install ruby-oci8

In one word, If you’ve set up oracle db stuff and LD_LIBRARY_PATH well, simply run:

  $ sudo gem install ruby-oci8 

or

  $ sudo gem update ruby-oci8  (for update)

No “download ruby-oci8.tgz and ruby setup.rb” any more :)

Enjoy!

When launching a rails 2.0 app, error occurs:

C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:319:in `activate’: can’t activate activerecord (= 1.15.6), already activated activerecord-2.0.2] (Gem::Exception)

To fix this, simply uninstall old rails gem by executing:

gem cleanup

ref: http://www.ruby-forum.com/topic/137509

Static Class gadgets.views.ViewType

<!– Defined in views.js –>

Used by Views.

Field Detail


CANVAS

<static> object CANVAS
    A view where the gadget is displayed in a very large mode. It is typically the main content on the page. The viewer is not always the same as the owner.

HOME

<static> object HOME
    A view where the gadget is displayed in a small area usually on a page with other gadgets. Typically the viewer is the same as the owner.

PREVIEW

<static> object PREVIEW
    A demo view of the gadget. In this view the owner and viewer are not known.

PROFILE

<static> object PROFILE
    A view where the gadget is displayed in a small area usually on a page with other gadgets. The viewer is not always the same as the owner.

Back to top

Static Class gadgets.window

<!– Defined in dynamic-height.js –>

Provides operations for getting information about and modifying the window the gadget is placed in. 

Method Detail

adjustHeight

<static> adjustHeight(opt_height)
    Adjusts the gadget height. Make sure to include <Require feature=”dynamic-height” /> in <ModulePrefs><ModulePrefs/>;

    Parameters:

      Number opt_height - An optional preferred height in pixels; If not specified, will attempt to fit the gadget to its content. e.g  adjustHeight(‘300px’)

getViewportDimensions

<static> Object getViewportDimensions()

    Returns:

      Object  An object with width and height properties (height of the content, not the height you see)
 

I attended the Google OpenSocial Hackathon in Beijing on Jun 13,  hold by several important OpenSocial guys from Google US HQ:

Dan Peterson: Google Product Manager of open social
Shawn Shen: Google Developer Program
Jason Costa: Google Technical Programs Manager
Chris Schalk: Google Developer Advocate (ex-Oracler)

They and 3 google china employees introduced OpenSocial essentials, shared their experience and ongoing projects with us.  Most of the audience are google’s opensocial partners in China, including: tianya.cn, myspace.cn, 51.com, tianji.com, xiaonei.com, 163.com etc.

group photo 合影

Here is a short summary of this event (in Chinese). Useful resources and PPTs are listed below:

OpenSocial概览 (简介):
http://docs.google.com/Presentation?id=dgqxv878_199ccfbd9cc

RESTful API (OAuth & Signed Fetch):
http://docs.google.com/Presentation?id=dgqxv878_294f5k73bg7

OpenSocial小工具 – JavaScript API:
http://docs.google.com/Presentation?id=dgqxv878_275d8xfk3gz

Life of a Gadget:
http://docs.google.com/Presentation?id=dgqxv878_113hhsfg9zp

OpenSocial Flash API:
http://opensocial-resources-zh.googlecode.com/svn/trunk/opensocial-fl…

OpenSocial小工具实验室:
http://opensocial-resources-zh.googlecode.com/svn/trunk/gadget-dev-tu…

Shindig概览:
http://docs.google.com/Presentation?id=dgqxv878_319dd28w4hr

受限系统的容器托管服务(草案):
http://docs.google.com/Presentation?id=dgqxv878_367d2p98md2

OpenSocial模板系统:
http://docs.google.com/Presentation?id=dgqxv878_342gn5ww4fj

Closing discussion:
http://docs.google.com/Presentation?id=dgqxv878_34cm27dzgc

资源链接页面:
http://docs.google.com/Doc?id=dgqxv878_366g253xmdk

活动照片:
http://tinyurl.com/67e72g
http://tinyurl.com/5qub2a

 

Google Code:
http://code.google.com/intl/zh-CN/
OpenSocial Developer Documentation:
http://code.google.com/intl/zh-CN/apis/opensocial/
OpenSocial Forums:
http://groups.google.com/group/opensocial-china?hl=zh-CN.
To help shape the spec:
http://groups.google.com/group/opensocial-and-gadgets-spec/
OpenSocial v0.8 spec:
http://tinyurl.com/5qdzwq
OpenSocial RESTful API Spec:
http://tinyurl.com/6yuzch
To check out and build Shindig:
http://incubator.apache.org/shindig/#tab-home
Subscribe to the Shindig mailing list:
shindig-dev-subscribe@incubator.apache.org
Architectural Overview of Shindig:
http://tinyurl.com/57qalf

Implementing Shindig tutorial (Java, PHP):
http://chrisschalk.com/shindig_docs/io/shindig-io.html
Installing Shindig (for Windows):
http://chabotc.com/guides/shindig_install/
OpenSocial Templates Proposal:
http://groups.google.com/group/opensocial-and-gadgets-spec/web/opensocial-templates
How to build a Gadget tutorial:
http://opensocial-resources-zh.googlecode.com/svn/trunk/gadget-dev-tutorial/Tutorial.html

When using two JDBC connections accessing the same Oracle database, “SqlException : No more data to read from socket” thrown.

This is  because your database doesn’t support connection sharing, or it’s a dedicated server that will not respond to different clients.

Solution 1:

  1. $ dbca
  2. –Configuration & Migration Tool
  3. —-database Configuration Assistant
  4. Select radio button —Configure Data base options in database
  5. Select your database—e.g. Oracle or pspl
  6. Select —– shared server mode

Solution 2 (same to 1 but manual work):

  1. open $ORACLE_HOME/network/admin/tnsnames.ora
  2. change “(SERVER = DEDICATED)” to “(SERVER = SHARED)”
  3. restart database and listener

Now your database is sharable, so we can use from different client.

Thanks http://www.orafaq.com/forum/t/47457/0/

When using an apache http server, do remember to set the files’ accessing mode to at least 644 :  chmod 644 filename

Older Posts »