CCNA – network simulation

I was looking for good network simulator for CCNA. After lot of search I found two very useful simulators.

  1. Cisco Packet Tracer – Cisco propitiatory simulator. This one is awesome for network device support they have provided. You can drag and drop router, links, PC, server and most importantly switches. There are very few simulators which supports switch operations out of the box. GUI mode operations are very very easy, also CLI mode is easily accessible. Only problem is this is closed box simulator hence you can not connect it with real life network.
  2. GNS3 - Open source graphical network simulator. Its free, easy to use and supports meany Cisco devices. Catch – no support for switch and more than that you must have your own Cisco IOS image. Concept is simple, feed the IOS to GNS3 and it will simulate whole network for you. But you can connect your GNS3 to real life network.

JNDI resources: JDBC connection pooling

What is JNDI resource? in simplest term the name that we will be using to identify resource(in our case connection JDBC connection pool to Oracle)

Resource creation

We will create global resource by adding its details in server.xml in tomcat.
$CATALINA_HOME/conf/server.xml

<Resource name="jdbc/myDB"
		    auth="Container"
		    type="javax.sql.DataSource"
		    username="<<DB_user>" password="<<DB_pass>>"
		    driverClassName="oracle.jdbc.OracleDriver"
		    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
		    url="jdbc:oracle:thin:@localhost:1521:XE"
		    maxActive="20"
		    maxIdle="10"
		    maxWait="-1"
		   />

Config is simple as it looks
JNDI Name for resource will be : jdbc/myDB
username: database user name
password: database user password
driverClassName : In our case its Oracle dirvers
url: connection url to db server.

Context reference

Reference of resource will be specified in context.xml
$CATALINA_HOME/conf/context.xml

<ResourceLink name="jdbc/myDB"
           global="jdbc/myDB"
           type="javax.sql.DataSource"/>

Environment:

Tomcat 6
Oracle 10G Express edition

Working code

  1. Create user tomcat in Oracle with password tomcat
  2. Execute SQL to create table in tomcat schema
  3. Replace (or copy content of) server.xml & context.xml from config folder
  4. Copy jstl libs from lib folder
  5. Download and copy ojdbc6.jar from Oracle
  6. Copy JNDI folder in webapps

JNDI

Ref:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
http://www.datadisk.co.uk/html_docs/java_app/tomcat6/tomcat6_jdbc.htm