Your schema.txt has 1 error (there should be a comma after VARCHAR(255)) and 3 phrases the MySQL parser doesn't currently support:
1. mydb.table1- parser expects only the table name 2. COMMENT "ID"- parser doesn't handle field comments 3. DEFAULT NOW()- parser doesn't handle NOW() as a default value for a TIMESTAMP field The DBI problem appears to be a MySQL issue. Judging from the error's location, you probably have a table named 'Database' and the DBI parser tries to send the command 'show create table Database' to the server. I tried this on my MySQL server and the server rejects it as invalid syntax, perhaps because Database is a reserved word or something? The only real way I see around this is to remove the Database table from your database. Also, if the database you're connecting to has similar schema as your schema.txt example, using the DBI Parser isn't going to make much difference. All it does is dump the schema from the database to a variable and then uses the regular MySQL Parser to parse it, so you'll just end up with similar results. Chris > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Adam Stein > Sent: Friday, 02 February, 2007 14:53 > To: [email protected] > Subject: [sqlfairy-developers] Having problems running sqlt > > Just installed SQL-Translator and can't get it to work. I > first tried a simple example from the docs: > > sqlt -f MySQL -t PostgreSQL ~/schema.txt > > 'schema.txt' looks like this: > > # Remove the database if it exists > DROP DATABASE IF EXISTS mydb; > > # Create the database > CREATE DATABASE mydb; > > # Create the Announcement table > CREATE TABLE mydb.table1 ( > ID > BIGINT UNSIGNED > NOT NULL > AUTO_INCREMENT > PRIMARY KEY > COMMENT "ID", > text > VARCHAR(255) > date > TIMESTAMP > DEFAULT NOW() > ) TYPE=innodb; > > which I can feed into the MySQL command line program. I get > the following error: > > ERROR (line 8): Invalid statement: Was expecting > comment, or use, or > set, or drop, or create, or alter, or > insert, or > delimiter, or empty statement > Error: translate: Error with parser 'SQL::Translator::Parser::MySQL': > no results at /packages/bin/sqlt line 319. > > I try connecting directly to my MySQL database figuring that > if I don't have the correct format of schema file, sqlt > should be able to get it from the database itself (which is > really what I want). That gives me the error: > > "my" variable $v masks earlier declaration in same scope at > /packages/lib/perl5/site_perl/5.8.5/SQL/Translator/Parser/DBI/DB2.pm > line 274. > DBD::mysql::st execute failed: You have an error in your SQL > syntax; check the manual that corresponds to your MySQL > server version for the right syntax to use near 'Database' at > line 1 at > /packages/lib/perl5/site_perl/5.8.5/SQL/Translator/Parser/DBI/ > MySQL.pm line 60. > Error: translate: Error with parser 'SQL::Translator::Parser::DBI': > DBD::mysql::st execute failed: You have an error in your SQL > syntax; check the manual that corresponds to your MySQL > server version for the right syntax to use near 'Database' at > line 1 at > /packages/lib/perl5/site_perl/5.8.5/SQL/Translator/Parser/DBI/ > MySQL.pm line 60. > > I'm running Perl v5.8.5 with DBI-1.53 and DBD-mysql-4.001 > with a MySQL engine v5.0.27. I've used DBI/DBD-mysql > directly in my own Perl programs with no problem (fetching data only). > > Anybody know what could be wrong? Thanks in advance for any help. > -- > Adam Stein @ Xerox Corporation Email: [EMAIL PROTECTED] > > Disclaimer: All views expressed > here have been proved to be my own. [http://www.csh.rit.edu/~adam/] > > > -------------------------------------------------------------- > ----------- > Using Tomcat but need to do more? Need to support web > services, security? > Get stuff done quickly with pre-integrated technology to make > your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on > Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057& > dat=121642 > -- > sqlfairy-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sqlfairy-developers > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 -- sqlfairy-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sqlfairy-developers
