From: ZalekBloom on
I am just learning Ruby language. I downloaded SQLite3 database using
gem - "gem list" shows that SQLite3 is installed.
My question - how to create a database? I tried to do it from a DOS
prompt - it didn't work.

Thanks,

Zalek
From: Hassan Schroeder on
On Thu, Jun 24, 2010 at 2:35 PM, <ZalekBloom(a)hotmail.com> wrote:
> I am just learning Ruby language. I downloaded SQLite3 database using
> gem - "gem list" shows that SQLite3 is installed.

No, that shows that the SQLite3 *gem* is installed. Which doesn't
mean you have SQLite3 itself on your system. Figuring that out is
a good first step :-)

> My question - how to create a database? I tried to do it from a DOS
> prompt - it didn't work.

Urk, "DOS prompt"? So, Windows? Best of luck!

(And for the next question, "it didn't work" is not terribly useful in terms
of helping someone troubleshoot a problem...)

HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder(a)gmail.com
twitter: @hassan

From: ZalekBloom on
On Thu, 24 Jun 2010 17:51:55 -0500, Hassan Schroeder
<hassan.schroeder(a)gmail.com> wrote:

>On Thu, Jun 24, 2010 at 2:35 PM, <ZalekBloom(a)hotmail.com> wrote:
>> I am just learning Ruby language. I downloaded SQLite3 database using
>> gem - "gem list" shows that SQLite3 is installed.
>
>No, that shows that the SQLite3 *gem* is installed. Which doesn't
>mean you have SQLite3 itself on your system. Figuring that out is
>a good first step :-)
>
>> My question - how to create a database? I tried to do it from a DOS
>> prompt - it didn't work.
>
>Urk, "DOS prompt"? So, Windows? Best of luck!
>
>(And for the next question, "it didn't work" is not terribly useful in terms
>of helping someone troubleshoot a problem...)
>
>HTH,

Well, I tried from DOS:
create database
gem create database

and other combinations.

Anyway - I understand I need to install SQLite3 first.

Thanks,

Zalek
From: R.. Kumar on
unknown wrote:
> I am just learning Ruby language. I downloaded SQLite3 database using
> gem - "gem list" shows that SQLite3 is installed.
> My question - how to create a database? I tried to do it from a DOS
> prompt - it didn't work.
>
> Thanks,
>
> Zalek

require 'sqlite3'
db = SQLite3::Database.new( "test.db" )
sql = <<SQL
create table the_table (
a varchar2(30),
b varchar2(30)
);

SQL

db.execute_batch( sql )

-------
Of course, you should have sqlite3 installed. there should be some
command called "sqlite3" in your path, if it is.

to open a db, do:

sqlite3 new.db


You should get a prompt. Type "help".

See: http://sqlite-ruby.rubyforge.org/sqlite3/faq.html
--
Posted via http://www.ruby-forum.com/.