[redland-dev] Storage Creation Failed
carmen
_ at whats-your.name
Sat Jun 2 13:46:59 BST 2007
> I have the following error:
>
> Storage Creation Failed.
>
> when trying to execute :
>
> Redland::HashStore.new('bdb', 'redland.db', '', false)
>
> I don't know how to solve this ?
i do this. its more of a flexible failover solution:
def open_store n=""
d = File.dirname(__FILE__)
c = YAML.load( File.open( d+'/.c' ) ) || {'store' => 'bdb'}
t = c['store'] || "mysql"
@store ||= (case t
when "bdb"
Redland::HashStore.new(hash_type='bdb',name='db',dir=d, want_new=false,write=true,contexts=false)
else
Redland::TripleStore.new("#{t}",'m',"host='#{c['host'] || "localhost"}',database='#{c['db']}',user='#{c['user']}',#{c['pass'] ? "password='#{c['pass']}'," : ""}reconnect='yes'#{n}")
end)
end
def start
begin
open_store
rescue Redland::RedlandError
puts "creating new store"
open_store ",new='yes'"
end
@model ||= Redland::Model.new(@store)
end
all :start on app launch..
for config, theres a file named '.c' (.* and *.db is in .gitignore)
store: mysql
db: lottastuf
user: user
pass: pass
among other things if youre using a sql store, and it can connect but the schema doesnt exist, it creates it for you. if it can't connect, its just going to fail twice, but otherwise nothing will be harmed. likewise you don't even need the '.c' file then it just defaults to a bdb in the homedir. some of this could proably be added to the bindings to make them more supple, but thats way down my todo list :)
More information about the redland-dev
mailing list