Wednesday, March 25, 2009

How to connect to a database server using javaScript?

JavaScript is a scripting language used to enable programmatic access to objects within other applications. It is primarily used in the form of client-side JavaScript for the development of dynamic websites.
Connecting to a database server using javaScript may not be desirable in many instances but
nobody prevents us from doing so.
One of the way of achieving this as below:
Open Notepad.Paste the below code (excluding # of course) in it & save as ".html"

#########################################################

<html>
<head>
<script language="JavaScript">
function testConnection()
{
var dbHost = document.getElementById("txtServerName");
var dbUser = document.getElementById("txtUserName");
var dbPassword = document.getElementById("txtPassword");
var dbProvider = document.getElementById("txtProvider");
var dbDefault = document.getElementById("txtDefaultDB");
var conn_str = "Provider=" + dbProvider.value + ";Data Source=" + dbHost.value + "; User Id=" + dbUser.value + "; password=" + dbPassword.value + "; Initial Catalog=" + dbDefault.value;

var cn = new ActiveXObject("ADODB.Connection");

if(cn)
{
alert(conn_str);

cn.Open(conn_str);

alert("Connected to database...");

cn.close();

return true;
}
return false;
}
function resetFields()
{
var dbHost = document.getElementById("txtServerName");
var dbUser = document.getElementById("txtUserName");
var dbPassword = document.getElementById("txtPassword");
var dbProvider = document.getElementById("txtProvider");
var dbDefault = document.getElementById("txtDefaultDB");

dbHost.value = "";
dbUser.value = "";
dbPassword.value = "";
dbProvider.value = "";
dbDefault.value = "";

return true;
}
</script>
</head>
<body>
<center>
<br><br><br><br><br>
<h1>Connecting to a database using javaScript</h1>
<table>
<tr>
<td>Server Name</td>
<td><input type="text" id="txtServerName"></td>
</tr>
<tr>
<td>User Name</td>
<td><input type="text" id="txtUserName"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" id="txtPassword"></td>
</tr>
<tr>
<td>Provider</td>
<td><input type="text" id="txtProvider" value="SQLOLEDB"></td>
</tr>
<tr>
<td>Default DB</td>
<td><input type="text" id="txtDefaultDB" value="TESTDB"></td>
</tr>

<tr>
<td><input type="button" value="Connect" onclick="testConnection();"></td>
<td><input type="button" value="Reset" onclick="resetFields();"></td>
</tr>
</table>
</center>
</body>
</html>

#########################################################

Wednesday, June 11, 2008

World's second longest bridge


THE Mumbai Trans Harbour Link, that found special mention by the Finance Minister, Mr P. Chidambaram, during his Budget speech, is up and running. Six international consortiums pitted against each other in the RFQ (request for quotation) stage for the first phase implementation of what is billed to become the second longest bridge in the world. Currently, the longest such linkage is the one between Malmo in Sweden and Copenhagen in Denmark.

It will take up to 40 months to complete the engineering and construction work of the trans harbour sea link. As of now, there is an in-principle decision to name the bridge after JRD Tata


The first phase is estimated to cost Rs 4,000 crore and will have a 22.5-km, six-lane sea link connecting Nhava in mainland Mumbai and Sewri in the island city. From Sewri, there will be two `dispersal systems' — essentially overhead bridges across the existing roads. One will be an eight-km bridge connecting Sewri with Colaba and another, a four-km bridge between Sewri and Worli. The Union Government funding is expected to be around Rs 1,000 crore.

The project had attracted the interest of Indian majors such as Reliance Energy, L&T, Gammon India, Shapoorji Pallonji, IL&FS. Among the international heavyweights are Hyundai, Bouygues, Italthai and China Harbour.


This project is seen to be of vital importance with the Mumbai Western Expressway sea link remaining a non-starter as periodic delays have led to high cost escalation. The project cost of Rs 4,000 crore is only for the first phase of the Sewri-Nhava sea link as the second phase envisages a railway link at an outlay of Rs 2,600 crore.

A dream project of Sir J.R.D. Tata, who chaired a committee for its implementation way back in 1981, the trans harbour link may finally get commissioned by 2009.

The six consortiums are:

Reliance Energy Ltd - Hyundai Engineering & Construction (Won the bid)

L&T-Gammon India-Bouygues Enterprises, France

IL&FS-Laing O'Rourke, UK-Macquarie Bank, Australia

Shapoorji Pallonji Construction, with German partner

Italthai Engineering, Thailand-Skalska, Sweden

China Harbour Engineering, Hong Kong






Thursday, June 5, 2008

Euro 2008




The 2008 UEFA European Football Championship, commonly referred to as Euro 2008, will take place in Austria and Switzerland from 7 June to 29 June 2008.



A total of 16 teams will participate in the tournament. Austria and Switzerland automatically qualified as hosts; the remaining 14 teams have been determined through qualifying matches which started in August 2006.

Austria
Croatia
Czech Republic
France
Germany
Greece
Italy
Netherlands
Poland
Portugal
Romania
Russia
Spain
Sweden
Switzerland
Turkey


Austria and Poland will be making their first appearance in the tournament. The winner of Euro 2008 will represent UEFA at the 2009 FIFA Confederations Cup in South Africa, unless Italy wins the tournament, in which case the runner-up will be entered, as Italy is already entered as the winner of the 2006 FIFA World Cup.



The new trophy can be viewed at : http://en.wikipedia.org/wiki/Image:New_Henri_Delaunay_Trophy.jpg



UEFA announced that total of €184 million has been offered to the 16 teams competing in this tournament, increasing from €129 million in the previous tournament. The distributions as below:
Participating fee: €7.5 million
Extra payment based on teams performances:
Group stage (per match):
Win: €1 million
Draw: €500,000
Quarter-finals: €2 million
Semi-finals: €3 million
Runner-up: €4.5 million
Winner: €7.5 million
If the winner of the tournament wins all three matches in the group stage, they will receive a total prize of €23 million

All the matches can be seen on ESPN from 7th of June 2008.




Wednesday, June 4, 2008

Statue Of Shivaji Maharaj



The Statue of Liberty is set to be overshadowed, albeit on the other side of the Atlantic. The Government of Maharashtra has decided to install a 309-foot-tall Shivaji statue, four feet taller than the New York monument and the tallest in India in the Arabian Sea off Mumbai’s Marine Drive.



Chief Minister Vilasrao Deshmukh and his deputy R R Patil visited the site with senior officials today and Deshmukh directed his officers to ensure quick clearances for the Rs 200-crore project, officials told The Indian Express.


They said the statue will have a 150-foot-high pedestal on which will be installed a 159-foot-tall bronze of Shivaji riding a horse. That would make it taller than a 30-storey building and the tallest statue in the country, dwarfing the Hanuman statue in New Delhi which is 174 feet tall. It would be among the top 10 tallest statues in the world, a list which is mostly dominated by Buddha statues in east Asia.


The project is estimated to take two years and is subject to environment clearances. Besides, BSNL cables on the seabed will have to be shifted.The government’s plans to hunt for a location had run into problems. While the Navy refused permission to install it at Oyster Rocks off the eastern coast, the Mumbai Port Trust rejected a second location at Cross Island. The new location finalised today will be at the centre of the curvature of the Queen’s Necklace where the state plans to make an artificial island by reclaiming 7.5 acres about 1 km from the shore.


Besides housing the statue, the island will serve as a tourist spot with a sound and light show based on the life of Shivaji, a museum, a library, an eatery and an ornamental garden. A jetty at the National Centre for Performing Arts at the end of Marine Drive will ferry tourists to the island.