Friday, September 18, 2009

Java mistakes by me-part 1 (A new venture...)

I was trying to establish a connection with an Oracle server for database connection using JDBC with the following syntaxes:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc.oracle.thin:@ip:port:",
"username","password");

I got the following errors during runtime after various stages and combinations of syntaxes:
1) noclassdeffounderror
2) unsupportedclassversionerror
3) sqlException
After breaking my head for nearly 5 hours I found that the solution is very simple.
What was missing is that the in the jre folder of the java sdk installation the classes12.jar file was not defined which defines the OracleDriver class.

Solution:

just get the classes12.jar file from the oracle folder. For me it was in a folder like:
"C:\oracle\product\10.2.0\db_1\jdbc\lib"
just copy it from the folder defined similarly in your computer and paste it in the folder like:
"C:\JDK\j2sdk1.4.2_13\jre\lib\ext"
and then execute your java program and access your database.

Also i found that we can declare the driver class also as below:
Class.forName("oracle.jdbc.OracleDriver");

It runs just fine :).

Tuesday, January 20, 2009

My Day

Pre-breakfast: 12 rounds of swimming pool; 7 breaststroke 5 freestyle; totally 600 meters

Breakfast:~2 cups of sprouted dal, 15 slices of cucumber, ~1/2 cup of chopped tomato, 4 slices of white bread,2 teaspoons butter, 1 glass of milk

Post breakfast- 6 chapters of the Novel by David Davidar-"The House of Blue Mangoes"( my first attempt at reading a 300+ pages novel)

Lunch: 4 rotis, 1 cup of chopped and fried beetroot, 2 cups of kadi with pakodas, 1 cup of yoghurt,1 cup of yellow split pea

post lunch: disappointing meeting with the professor

Evening: 1 glass of milk

Late evening: Jog through Institute- starting at Tapti Hostel following the road leading to playing grounds then tracing Biotechnology Department, the CAD desgin block, the Rarefied Gas Dynamics Laboratory, an abandoned 1 seat flying craft, the Campus Cafe, the Institute hospital, Kendra Vidyalaya, NSS water tank, Vana Vani, the border wall of Guindy National Park, the iconic IIT Main Gate, the Jalakanteswarar Temple, the Ladies Club, the Sree Durga Peeli Amman Temple, the Director's Residence, the Institute Stadium, the SAC centre, the Institute Gym( 5 pull ups, 6 pushups) and from the gym a walk back to the tapti hostel tracing along the way Sindhu, Institute Swimming Pool, Godavari Hostel, a view of Himalaya Mess, Basera, Side View of Saraswathi and finally back to Tapti Hostel.

Dinner: 7 pooris, 2 cups of aloo curry, 1 cup of yellow pulses, 1 cup of buttermilk, 1 banana

post dinner: A sudden rush of nostalgia. 5 years at IIT!