Tuesday, October 9, 2012


How to connect Java Application with Oracle Database using JDBC Driver - Part 1

Today I will go through the basic steps to connect a Java Application with Oracle Database using JDBC Driver (Java Database Connectivity). To develop Enterprise Product connectivity of java application and oracle database is essential. When I was new to java, i have faced some problem for java and database connectivity using jdbc. So I want to make all this process bit easier for all the new comer in java and windows platform.





Your Ad Here

Prerequisites :
Microsoft Windows Xp Service Pack 2 or above.
Java Developement Kit.
Oracle Database.
Oracle JDBC Driver.According to your database version.
One Integrated Development Environment.like Netbeans,Eclipse
Steps for configuring the system and creating DSN (ODBC Data Source):
Install Java Development Kit and Oracle Database.
Place Oracle JDBC Driver (*.jar file) in java runtime folder and java development kit folder . eg: 'C:\Program Files\Java\jre1.6.0\lib\ext' and 'C:\Program Files\Java\jdk1.6.0\jre\lib\ext'.
Create a Data Source Name (DSN) required for database connectivity in windows.
For DSN go to Start->Control Panel->Administrative Tools->Data Sources (ODBC).

ODBC Data Source Administrator will open. Click on the Add button to create a new data source.

Select 'Microsoft ODBC for Oracle' & click Next.
Fill the Data Source Name - name for the data source, Description - Just a simple description, User Name - Oracle Database User name, Server - name of the server where database is installed ,( localhost - if it is installed in the local machine or the IP if the the database is installed in a remote machine). Click OK and close the ODBC Data Source Administrator.


Now, the system is configured to run any java oracle connectivity program.You can start coding the program in any IDE or open a notpad.

Below is the source code of a jdbc program to determine wheather all your setting are OK or not. Compile the program and execute it. If the program is executed without any error or exception and you get 'JDBC Driver loaded' and 'Connected to the Oracle Database' as output then you have done all the setting correctly and you are able to connect to the oracle database through your java program.
If you encounter any problem please get back to me, I will help you to sought out the problem.


Source code :

import java.sql.*;

public class ConnectOracle {

 public static void main(String[] args) {
 
  String driver="sun.jdbc.odbc.JdbcOdbcDriver"; //
  String cs="jdbc:odbc:connectOracle"; //connectOracle is the data source name
  String user = "system"; //username of oracle database
  String pwd = "tom"; //password of oracle database
  Connection con = null; //connection variable assigned to null
 
  try
  {
   Class.forName(driver);// for loading the jdbc driver
  }
  catch(Exception e)
  {
   System.out.println(e);
  }
 
  System.out.println("JDBC Driver loaded");
 
  try
  {
   con=DriverManager.getConnection(cs,user,pwd);// for establishing connection with database
  }
  catch(Exception e)
  {
   System.out.println(e);
  }
 
  System.out.println("Connected to the Oracle Database");
 
  try
  {
   con.close();
  }
  catch(Exception e)
  {
   System.out.println(e);
  }
 
  }//end of main()
 }//end of class()

Monday, October 8, 2012

VIRUAL MEMORY

                                                Basic Virtual Memory Concepts

                  While the technology behind the construction of the various modern-day storage technologies is truly impressive, the average system administrator does not need to be aware of the details. In fact, there is really only one fact that system administrators should always keep in mind:

                  There is never enough RAM.

                  While this truism might at first seem humorous, many operating system designers have spent a great deal of time trying to reduce the impact of this very real shortage. They have done so by implementing virtual memory — a way of combining RAM with slower storage to give a system the appearance of having more RAM than is actually installed.

                                               Virtual Memory in Simple Terms 

Let us start with a hypothetical application. The machine code making up this application is 10000 bytes in size. It also requires another 5000 bytes for data storage and I/O buffers. This means that, to run this application, there must be 15000 bytes of RAM available; even one byte less, and the application would not be able to run.

This 15000 byte requirement is known as the application's address space. It is the number of unique addresses needed to hold both the application and its data. In the first computers, the amount of available RAM had to be greater than the address space of the largest application to be run; otherwise, the application would fail with an "out of memory" error.

A later approach known as overlaying attempted to alleviate the problem by allowing programmers to dictate which parts of their application needed to be memory-resident at any given time. In this way, code only required once for initialization purposes could be written over (overlayed) with code that would be used later. While overlays did ease memory shortages, it was a very complex and error-prone process. Overlays also failed to address the issue of system-wide memory shortages at runtime. In other words, an overlayed program may require less memory to run than a program that is not overlayed, but if the system still does not have sufficient memory for the overlayed program, the end result is the same — an out of memory error.

With virtual memory, the concept of an application's address space takes on a different meaning. Rather than concentrating on how much memory an application needs to run, a virtual memory operating system continually attempts to find the answer to the question, "how little memory does an application need to run?"

While it at first appears that our hypothetical application requires the full 15000 bytes to run, think back to our discussion in Section 4.1 Storage Access Patterns — memory access tends to be sequential and localized. Because of this, the amount of memory required to execute the application at any given time is less than 15000 bytes — usually a lot less. Consider the types of memory accesses required to execute a single machine instruction:



               *   The instruction is read from memory.


               *  The data required by the instruction is read from memory.


               *  After the instruction completes, the results of the instruction are written back to memory.

The actual number of bytes necessary for each memory access varies according to the CPU's architecture, the actual instruction, and the data type. However, even if one instruction required 100 bytes of memory for each type of memory access, the 300 bytes required is still much less than the application's entire 15000-byte address space. If a way could be found to keep track of an application's memory requirements as the application runs, it would be possible to keep the application running while using less memory than its address space would otherwise dictate.

                                 Backing Store — the Central Tenet of Virtual Memory

The short answer to this question is that the rest of the application remains on disk. In other words, disk acts as the backing store for RAM; a slower, larger storage medium acting as a "backup" for a much faster, smaller storage medium. This might at first seem to be a very large performance problem in the making — after all, disk drives are so much slower than RAM.

While this is true, it is possible to take advantage of the sequential and localized access behavior of applications and eliminate most of the performance implications of using disk drives as backing store for RAM. This is done by structuring the virtual memory subsystem so that it attempts to ensure that those parts of the application currently needed — or likely to be needed in the near future — are kept in RAM only for as long as they are actually needed.

In many respects this is similar to the relationship between cache and RAM: making the a small amount of fast storage combined with a large amount of slow storage act just like a large amount of fast storage.

Switched-mode power supply

Switched-mode power supply
             
            A switched-mode power supply (switching-mode power supply, SMPS, or switcher) is an electronic power supply that incorporates a switching regulator to convert electrical power efficiently. Like other power supplies, an SMPS transfers power from a source, like mains power, to a load, such as a personal computer, while converting voltage and current characteristics. An SMPS is usually employed to efficiently provide a regulated output voltage, typically at a level different from the input voltage.

              Unlike a linear power supply, the pass transistor of a switching-mode supply continually switches between low-dissipation, full-on and full-off states, and spends very little time in the high dissipation transitions (which minimizes wasted energy). Ideally, a switched-mode power supply dissipates no power. Voltage regulation is achieved by varying the ratio of on-to-off time. In contrast, a linear power supply regulates the output voltage by continually dissipating power in the pass transistor. This higher power conversion efficiency is an important advantage of a switched-mode power supply. Switched-mode power supplies may also be substantially smaller and lighter than a linear supply due to the smaller transformer size and weight.

             Switching regulators are used as replacements for the linear regulators when higher efficiency, smaller size or lighter weight are required. They are, however, more complicated; their switching currents can cause electrical noise problems if not carefully suppressed, and simple designs may have a poor power factor.

                                                          Advantages and disadvantages

The main advantage of this method is greater efficiency because the switching transistor dissipates little power when it is outside of its active region (i.e., when the transistor acts like a switch and either has a negligible voltage drop across it or a negligible current through it). Other advantages include smaller size and lighter weight (from the elimination of low frequency transformers which have a high weight) and lower heat generation due to higher efficiency. Disadvantages include greater complexity, the generation of high-amplitude, high-frequency energy that the low-pass filter must block to avoid electromagnetic interference (EMI), a ripple voltage at the switching frequency and the harmonic frequencies thereof.

Very low cost SMPSs may couple electrical switching noise back onto the mains power line, causing interference with A/V equipment connected to the same phase. Non-power-factor-corrected SMPSs also cause harmonic distortion.



Sunday, October 7, 2012

How To Create a Blog for Free in 4 Easy Steps

                               How To Create a Blog for Free in 4 Easy Steps
              Creating a blog might seem like a daunting task, and you might not know where to begin. Truth be told, it's very easy to create a blog (for free), and you can do it in under an hour by following these four simple steps. What are you waiting for? Join the blogosphere today!
Difficulty: Easy
Time Required: Less Than 30 Minutes
Here's How:


Step 1: Choose a free blogging software.

Read these articles from About.com Web Logs to help you choose the best blogging software for you:
6 Questions to Ask Yourself to Find the Best Blogging Software for You
Blogging Software Comparison



Step 2: Register for an account and create your blog

These articles from About.com Web Logs provide step-by-step instructions to help you start a blog with either of the two most popular free blogging softwares - Blogger.com and Wordpress.com.
How to Start a Free Blog with Blogger.com
How to Start a Free Blog with Wordpress.com



Step 3: Select Your Domain, Theme and Other Options.

During the registration process for your new blog account, you'll need to choose a domain name and blog theme. You also might want to take a few minutes before you actually start blogging to customize some of the other preferences for your blog that your blogging software allows you to modify such as the author name, comment moderation process, and so on. However, you're not required to do any customization before you start publishing blog posts.


Step 4: Start blogging.

Once you've completed steps 1-3, you're ready to join the blogosphere and start publishing content on your blog. There are many more ways you can customize your blog with plug-ins, feeds, blogrolls, and more, but these four easy steps are all you need to follow in order to start a simple blog.

Ethernet Cable

                                                                  Ethernet Cable
               The information listed here is to assist Network Administrators in the color coding of Ethernet cables. Please be aware that modifying Ethernet cables improperly may cause loss of network connectivity. Use this information at your own risk, and insure all connectors and cables are modified in accordance with standards. The Internet Centre and its affiliates cannot be held liable for the use of this information in whole or in part.


           The TIA/EIA 568-A standard which was ratified in 1995, was replaced by the TIA/EIA 568-B standard in 2002 and has been updated since. Both standards define the T-568A and T-568B pin-outs for using Unshielded Twisted Pair cable and RJ-45 connectors for Ethernet connectivity. The standards and pin-out specification appear to be related and interchangeable, but are not the same and should not be used interchangeably.

          Both the T-568A and the T-568B standard Straight-Through cables are used most often as patch cords for your Ethernet connections. If you require a cable to connect two Ethernet devices directly together without a hub or when you connect two hubs together, you will need to use a Crossover cable instead.

         A good way of remembering how to wire a Crossover Ethernet cable is to wire one end using the T-568A standard and the other end using the T-568B standard. Another way of remembering the color coding is to simply switch the Green set of wires in place with the Orange set of wires. Specifically, switch the solid Green (G) with the solid Orange, and switch the green/white with the orange/white.

Ethernet Cable Instructions:
Pull the cable off the reel to the desired length and cut. If you are pulling cables through holes, its easier to attach the RJ-45 plugs after the cable is pulled. The total length of wire segments between a PC and a hub or between two PC's cannot exceed 100 Meters (328 feet) for 100BASE-TX and 300 Meters for 10BASE-T.
Start on one end and strip the cable jacket off (about 1") using a stripper or a knife. Be extra careful not to nick the wires, otherwise you will need to start over.
Spread, untwist the pairs, and arrange the wires in the order of the desired cable end. Flatten the end between your thumb and forefinger. Trim the ends of the wires so they are even with one another, leaving only 1/2" in wire length. If it is longer than 1/2" it will be out-of-spec and susceptible to crosstalk. Flatten and insure there are no spaces between wires.
Hold the RJ-45 plug with the clip facing down or away from you. Push the wires firmly into the plug. Inspect each wire is flat even at the front of the plug. Check the order of the wires. Double check again. Check that the jacket is fitted right against the stop of the plug. Carefully hold the wire and firmly crimp the RJ-45 with the crimper.
Check the color orientation, check that the crimped connection is not about to come apart, and check to see if the wires are flat against the front of the plug. If even one of these are incorrect, you will have to start over. Test the Ethernet cable.

Ethernet Cable Tips:
A straight-thru cable has identical ends.
A crossover cable has different ends.
A straight-thru is used as a patch cord in Ethernet connections.
A crossover is used to connect two Ethernet devices without a hub or for connecting two hubs.
A crossover has one end with the Orange set of wires switched with the Green set.
Odd numbered pins are always striped, even numbered pins are always solid colored.
Looking at the RJ-45 with the clip facing away from you, Brown is always on the right, and pin 1 is on the left.
No more than 1/2" of the Ethernet cable should be untwisted otherwise it will be susceptible to crosstalk.
Do not deform, do not bend, do not stretch, do not staple, do not run parallel with power cables, and do not run Ethernet cables near noise inducing components.

Basic Theory:
        By looking at a T-568A UTP Ethernet straight-thru cable and an Ethernet crossover cable with a T-568B end, we see that the TX (transmitter) pins are connected to the corresponding RX (receiver) pins, plus to plus and minus to minus. You can also see that both the blue and brown wire pairs on pins 4, 5, 7, and 8 are not used in either standard. What you may not realize is that, these same pins 4, 5, 7, and 8 are not used or required in 100BASE-TX as well. So why bother using these wires, well for one thing its simply easier to make a connection with all the wires grouped together. Otherwise you'll be spending time trying to fit those tiny little wires into each of the corresponding holes in the RJ-45 connector.

LOGIC GATES

Logic gates

Digital systems are said to be constructed by using logic gates. These gates are the AND, OR, NOT, NAND, NOR, EXOR and EXNOR gates. The basic operations are described below with the aid of truth tables.

AND gate

The AND gate is an electronic circuit that gives a high output (1) only if all its inputs are high. A dot (.) is used to show the AND operation i.e. A.B. Bear in mind that this dot is sometimes omitted i.e. AB

OR gate

The OR gate is an electronic circuit that gives a high output (1) if one or more of its inputs are high. A plus (+) is used to show the OR operation.


NOT gate

The NOT gate is an electronic circuit that produces an inverted version of the input at its output. It is also known as an inverter. If the input variable is A, the inverted output is known as NOT A. This is also shown as A', or A with a bar over the top, as shown at the outputs. The diagrams below show two ways that the NAND logic gate can be configured to produce a NOT gate. It can also be done using NOR logic gates in the same way.

NAND gate

This is a NOT-AND gate which is equal to an AND gate followed by a NOT gate. The outputs of all NAND gates are high if any of the inputs are low. The symbol is an AND gate with a small circle on the output. The small circle represents inversion.

NOR gate

This is a NOT-OR gate which is equal to an OR gate followed by a NOT gate. The outputs of all NOR gates are low if any of the inputs are high.
The symbol is an OR gate with a small circle on the output. The small circle represents inversion.


EXOR gate

The 'Exclusive-OR' gate is a circuit which will give a high output if either, but not both, of its two inputs are high. An encircled plus sign () is used to show the EOR operation.

EXNOR gate


The 'Exclusive-NOR' gate circuit does the opposite to the EOR gate. It will give a low output if either, but not both, of its two inputs are high. The symbol is an EXOR gate with a small circle on the output. The small circle represents inversion.



The NAND and NOR gates are called universal functions since with either one the AND and OR functions and NOT can be generated.

ROUTER

Router
Definition:
Routers are small physical devices that join multiple networks together. Technically, a router is a Layer 3 gateway device, meaning that it connects two or more networks and that the router operates at the network layer of the OSI model.

Home networks typically use a wireless or wired Internet Protocol (IP) router, IP being the most common OSI network layer protocol. An IP router such as a DSL or cable modem broadband router joins the home's local area network (LAN) to the wide-area network (WAN) of the Internet.

By maintaining configuration information in a piece of storage called the routing table, wired or wireless routers also have the ability to filter traffic, either incoming or outgoing, based on the IP addresses of senders and receivers. Some routers allow a network administrator to update the routing table from a Web browser interface. Broadband routers combine the functions of a router with those of a network switch and a firewall in a single unit.
Networking With A Router
Using a router on broadband and/or wireless home networks

A network router is a small electronic device that allows you build a home network simply. The home router serves as the core or "centerpiece" of the network to which computers, printers and other devices can be connected. Networking with a router helps you to (for example):
share files between computers
share an Internet connection between computers
share a printer
connect your game console or other home entertainment equipment to the Internet
network. For example, you can connect two computers directly to each other with just a cable (or without wires in some cases). Home routers offer convenience and easier maintenance as your network grows. Related - Connecting Two Home Computers
Related - Connecting Two Home Computers
Choosing a Network Router
You can choose from among several different types of home network router products. The two most common types in popular usage are the 802.11b and 802.11g WiFi models. 802.11g is the newer technology, but 802.11b routers often can do the job for an even lower cost. More - Choosing a Wireless Router
Gear - Top 802.11g Wireless Routers
Gear - Top 802.11b Wireless Routers

Installing a Network Router
Network routers receive their power from an ordinary home electrical socket. When powered on, lights (LEDs) signify the unit is operating.

Network routers must be carefully configured when they are first installed. Like computers and other devices on the home network, routers must be set up with IP addresses. Routers also offer optional (but strongly recommended) security features.

Routers contain built-in software to enable setup. You access this software through your Web browser on any computer connected to the router. Network routers receive their power from an ordinary home electrical socket. When powered on, lights (LEDs) signify the unit is operating.

Network routers must be carefully configured when they are first installed. Like computers and other devices on the home network, routers must be set up with IP addresses. Routers also offer optional (but strongly recommended) security features.

Routers contain built-in software to enable setup. You access this software through your Web browser on any computer connected to the router.