Write a Perl program that stores URL information into a database using Win32::ODBC. The first field of the database should contain an actual URL and the second should contain a description of that URL.

What will be an ideal response?

```

1 #!perl

2 # Exercise 29.12 Solution

3 # Program to send url information to a database

4

5 use Win32::ODBC;

6 use CGI qw( :standard );

7

8 $url = param( "URL" );

9 $description = param( "DESCRIPTION" );

10

11 $query = "INSERT INTO URLTABLE (URL, DESCRIPTION) VALUES ('$url', '$description')";

12 $dataSourceName = "URL";

13

14 print header, start_html( "Database Update" );

15

16 print "$url
$description
$query
$dataSourceName
";

17

18 if ( !( $data = new Win32::ODBC( $dataSourceName ) ) )

19 {

20 print "Error connecting to $dataSourceName: ";

21 print Win32::ODBC::Error();

22 exit;

23 }

24

25 if ( $data->Sql( $query ) )

26 {

27 print "SQL failed. Error: ", $data->Error();

28 $data->Close();

29 exit;

30 }

31

32 print "

Database successfully updated.

";

33

34 $data->Close();

35 print end_html;

```



```

36

37