I have some problem with my code. If anybody can help me with this i will really appreciate it.

Here i am trying to retrieve all the data from a MSSQL database and inserting it in MYSQL database using a Perl Script (DBI). Till now i have successfully retrieved the data from the tables of the MSSQL database but i am unable to insert it into the MYSQL database. It is giving the following error.....

DBD::mysql::st execute failed: No Database Selected at abc.pl line 45.

DBD::mysql::st execute failed: No Database Selected at abc.pl line 45.

or i think the way i have written the query ( in the highlighted are below) is wrong.

Can any body please help me with this problem. Please see the highlited part of the code below. I am sure error lies here only.

#!/usr/local/bin/perl use DBI();

# Connect To Database # * The DBI interface to MySQL uses the method "connect" to make a # * connection to the database. It takes as it's first argument # * the string "DBI:mysql:database:hostname", where database is equal # * to the name of your database, and hostname to the server that it's # * located on. The second and third arguments, respectively, should # * be your account username and password. The connection is assigned # * to a variable that is used by most other methods in the module. $db = DBI->connect("DBI:Sybase:server=blue", platuser, gobigbird);

# Execute a Query # * executing a query is done in two steps. First, # * the query is setup using the "prepare" method. # * this requires the use of the variable used to # * initiate the connection. Second, the "execute" # * method is called, as shown below. $query = $db->prepare("SELECT id, name,addr1,addr2,city,state,zip,phone FROM cus tomer"); $query->execute;

# How many rows in result? # * the "rows" method using the variable name the # * query was executed under returns the number # * of rows in the result. $numrows = $query->rows;

# Cleaning Up # * with the DBI module, it is a good idea to clean up by # * explicitly ending all queries with the "finish" method, # * and all connections with the "disconnect" method. $query->finish; $db->disconnect;