From: Chris Morris Date: 2003-09-12T04:41:41+09:00 Subject: Re: DBI/ODBC question: how to create DB programmatically? Dave Halliday wrote: >Hi, > >I've been trying to figure out how to use ODBC with DBI. So far, I have >created a DSN for an existing DB and managed to read tables, update them, >etc, but I'd like to be able to create a new DB from scratch >programmatically (i.e. without any manual steps to create a DSN and add a >database). > Access: cat = WIN32OLE.new('ADOX.Catalog') cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=#{@out_mdb_fn}" SQL Server: db = WIN32OLE.new("ADODB.Connection") db.Open "Provider=SQLOLEDB;Data Source=myserver;Database=master;..." db.execute("CREATE DATABASE mydb") -- Chris http://clabs.org/blogki