[unixODBC-support] isql won't accept multiple SQL statements in a single call ?

Martin Evans martin.evans at easysoft.com
Mon Nov 10 09:18:53 GMT 2008


Maxim Veksler wrote:
> Hello list,
> 
> I'm trying to use isql in a "cat | isql" manner to populate our
> database scheme, I'm failing to understand why the following does not
> work.
> 
> isql is called as follows : """cat mysql_files/config_scheme.sql |
> isql -b myodbc5-ml ml dbAppPassword"""
> 
> """cat mysql_files/config_scheme.sql
> 
> -- MySQL dump 10.11
> --
> -- Host: localhost    Database: ml
> -- ------------------------------------------------------
> -- Server version       5.0.45-community-log
> 
> /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
> /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
> /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
> /*!40101 SET NAMES utf8 */;
> /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
> /*!40103 SET TIME_ZONE='+00:00' */;
> /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
> /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS,
> FOREIGN_KEY_CHECKS=0 */;
> /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
> /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
> 
> 
> --
> -- Table structure for table `cfg_compo_module`
> --
> 
> DROP TABLE IF EXISTS `cfg_compo_module`;
> CREATE TABLE `cfg_compo_module` (   `COMP_MODULE_ID` int(11) NOT NULL,
>   `COMP_ID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
> 
> --
> -- Table structure for table `cfg_components`
> --
> 
> DROP TABLE IF EXISTS `cfg_components`;
> CREATE TABLE `cfg_components` (   `COMP_ID` int(11) NOT NULL,
> `COMP_NAME` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT
> CHARSET=utf8;
> """ (more statements follow...)
> 
> 
> 
> If I run each statement in the file separately, it works flawlessly,
> but running them one after the other the script fails and no db
> modifications are performed.
> Please note that if I run the same script with mysql command line
> utility the operation is successful.
> 
> I would appreciate your help.
> 
> Thank you,
> Maxim.
> 

I don't believe you can have empty lines in isql input as it uses that 
to indicate you are finished and will stop processing the rest of the 
file. You look to have empty lines.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com


More information about the unixODBC-support mailing list