syntax error, unexpected ')'

Hi,

I tried the sample program for AJAX from the following site.

I created a table called catalogs and set the values.

I tried to load the data while entering the title of the book in the text field, I am getting the error messages

this line

ActiveRecord::Base.establish_connection(   :adapter => "mysql",   :host => "localhost", :database => "mydatabase",   :username => "root",   :password => )

should have some value for the :password thing. either use :password => nil or :password => ""

Thorsten Mueller wrote:

this line

ActiveRecord::Base.establish_connection(   :adapter => "mysql",   :host => "localhost", :database => "mydatabase",   :username => "root",   :password => )

should have some value for the :password thing. either use :password => nil or :password => ""

Hi, After I changed the above modification in the model, I am getting the following error.

Access denied for user 'root'@'localhost' (using password: NO)

This is my database.yml content

development:   adapter: mysql   encoding: utf8   database: mydatabase   username: root   password: password   host: localhost

The password also set as 'password' for the database, eventhough i gave the password I couldn't get the out put. what changes shoule be made.

Thanks in advance, Ravi

Hi, Just check this… ActiveRecord::Base.establish_connection( :adapter => “mysql”, :host => “localhost”, :database => “mydatabase”, :username => “root”, :password => “”; )

I hope this will work.

srinivas reddy wrote:

Hi, Just check this.. ActiveRecord::Base.establish_connection(   :adapter => "mysql",   :host => "localhost", :database => "mydatabase",   :username => "root",   :password => ""; )

I hope this will work.

Hi, I tried with the above changes... still I am having the problem...

herewith I attached the application codes I am using.

Please any one help me out this..

Thanks in Advance, Ravi

Attachments: http://www.ruby-forum.com/attachment/2432/catalog.zip

Get rid of that semicolon. Putting the mysql connection stuff in the model class is a bit odd.

Fred

Thorsten Mueller wrote: > this line

> ActiveRecord::Base.establish_connection( > :adapter => "mysql", > :host => "localhost", > :database => "mydatabase", > :username => "root", > :password => > )

> should have some value for the :password thing. > either use > :password => nil > or > :password => ""

Hi, After I changed the above modification in the model, I am getting the following error.

Access denied for user 'root'@'localhost' (using password: NO)

This is my database.yml content

development: adapter: mysql encoding: utf8 database: mydatabase username: root password: password host: localhost

You're not using database.yml because for some reason you're establishing the connection by hand in catalog.rb. If you're going to go that route then the call to establish_connection must contain valid credentials (check them in another mysql client first)

Fred