# Source db/slideshow\_data.sql

**URL:** <https://www.ruby-forum.com/t/source-db-slideshow-data-sql/127560>\
**Category:** Rails\
**Created:** [January 30, 2008, 12:22pm UTC](https://www.ruby-forum.com/t/source-db-slideshow-data-sql/127560 "2008-01-30T12:22:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [January 30, 2008, 12:22pm UTC](https://www.ruby-forum.com/t/source-db-slideshow-data-sql/127560/1 "2008-01-30T12:22:14Z")

</div>

From [examples / Ruby on Rails Up and Running · GitLab](http://examples.oreilly.com/rubyrails/) I downloaded src-start-  
chapter-4.zip and extraced the following file, which fails to import  
correctly. Is this a syntax problem, a database password problem, or  
what?

thufir@arrakis ~/oreilly-photos $  
thufir@arrakis ~/oreilly-photos $ cat db/slideshow\_data.sql -n | head -n  
2  
1 insert into slideshows values (1, ‘Interesting pictures’,  
now());  
2 insert into slides values (1, 1, 1, 1);  
thufir@arrakis ~/oreilly-photos $  
thufir@arrakis ~/oreilly-photos $ source db/slideshow\_data.sql  
bash: db/slideshow\_data.sql: line 1: syntax error near unexpected token  
`(' bash: db/slideshow_data.sql: line 1:`insert into slideshows values (1,  
‘Interesting pictures’, now())’  
thufir@arrakis ~/oreilly-photos $  
thufir@arrakis ~/oreilly-photos $ mysql -u root -p  
Enter password:  
Welcome to the MySQL monitor. Commands end with ; or \g.  
Your MySQL connection id is 43  
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql\> select \* from oreilly\_photos\_development.slide\_shows;  
±—±-----±--------------------+  
| id | name | created\_at |  
±—±-----±--------------------+  
| 1 | foo | 2008-01-30 00:13:50 |  
| 2 | bar | 2008-01-30 00:53:23 |  
| 3 | baz | 2008-01-30 01:34:39 |  
| 4 | blah | 2008-01-30 01:35:21 |  
±—±-----±--------------------+  
4 rows in set (0.50 sec)

mysql\> insert into oreilly\_photos\_development.slide\_shows  
(name,created\_at) values (“again”,NOW());  
Query OK, 1 row affected (1.42 sec)

mysql\> select \* from oreilly\_photos\_development.slide\_shows;  
±—±------±--------------------+  
| id | name | created\_at |  
±—±------±--------------------+  
| 1 | foo | 2008-01-30 00:13:50 |  
| 2 | bar | 2008-01-30 00:53:23 |  
| 3 | baz | 2008-01-30 01:34:39 |  
| 4 | blah | 2008-01-30 01:35:21 |  
| 5 | again | 2008-01-30 03:18:28 |  
±—±------±--------------------+  
5 rows in set (0.00 sec)

mysql\> quit;  
Bye  
thufir@arrakis ~/oreilly-photos $

thanks,

Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [January 30, 2008, 1:09pm UTC](https://www.ruby-forum.com/t/source-db-slideshow-data-sql/127560/2 "2008-01-30T13:09:38Z")

</div>

On Wed, 30 Jan 2008 11:21:04 +0000, Thufir wrote:

> From [examples / Ruby on Rails Up and Running · GitLab](http://examples.oreilly.com/rubyrails/) I downloaded src-start-  
> chapter-4.zip and extraced the following file, which fails to import  
> correctly. Is this a syntax problem, a database password problem, or  
> what?

Just to clarify, it can be done, but not at all in the way which the  
oreilly book says:

thufir@arrakis ~/oreilly-photos $  
thufir@arrakis ~/oreilly-photos $ mysql -u root -p  
Enter password:  
Welcome to the MySQL monitor. Commands end with ; or \g.  
Your MySQL connection id is 47  
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql\> select \* from oreilly\_photos\_development.slide\_shows;  
±—±------±--------------------+  
| id | name | created\_at |  
±—±------±--------------------+  
| 1 | foo | 2008-01-30 00:13:50 |  
| 2 | bar | 2008-01-30 00:53:23 |  
| 3 | baz | 2008-01-30 01:34:39 |  
| 4 | blah | 2008-01-30 01:35:21 |  
| 5 | again | 2008-01-30 03:18:28 |  
| 6 | again | 2008-01-30 03:50:31 |  
±—±------±--------------------+  
6 rows in set (0.00 sec)

mysql\> quit;  
Bye  
thufir@arrakis ~/oreilly-photos $  
thufir@arrakis ~/oreilly-photos $ cat db/data.sql  
insert into oreilly\_photos\_development.slide\_shows (name,created\_at)  
values (“fubar”,NOW());  
thufir@arrakis ~/oreilly-photos $  
thufir@arrakis ~/oreilly-photos $ source db/data.sql  
bash: db/data.sql: line 1: syntax error near unexpected token `(' bash: db/data.sql: line 1: ` insert into  
oreilly\_photos\_development.slide\_shows (name,created\_at) values  
(“fubar”,NOW());’  
thufir@arrakis ~/oreilly-photos $  
thufir@arrakis ~/oreilly-photos $ mysql -u root -p \< db/data.sql  
Enter password:  
thufir@arrakis ~/oreilly-photos $  
thufir@arrakis ~/oreilly-photos $ mysql -u root -p  
Enter password:  
Welcome to the MySQL monitor. Commands end with ; or \g.  
Your MySQL connection id is 49  
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql\> select \* from oreilly\_photos\_development.slide\_shows;  
±—±------±--------------------+  
| id | name | created\_at |  
±—±------±--------------------+  
| 1 | foo | 2008-01-30 00:13:50 |  
| 2 | bar | 2008-01-30 00:53:23 |  
| 3 | baz | 2008-01-30 01:34:39 |  
| 4 | blah | 2008-01-30 01:35:21 |  
| 5 | again | 2008-01-30 03:18:28 |  
| 6 | again | 2008-01-30 03:50:31 |  
| 7 | fubar | 2008-01-30 03:54:55 |  
±—±------±--------------------+  
7 rows in set (0.00 sec)

mysql\> quit;  
Bye  
thufir@arrakis ~/oreilly-photos $

thanks,

Thufir
