adodb with mysql - connection string syntax for filepath

Steve Holden steve at holdenweb.com
Mon Sep 17 19:51:36 EDT 2007


J. Cliff Dyer wrote:
> Mridula Ramesh wrote:
>> Dear all,
>>
>> Hi. I am not very tech-savvy so please pardon me if this is a stupid
>> question: so far I have been googling for about 4 days to find help
>> for this, so now I am desperate! :)
>>
>> How do you use adodb with mysql to connect to a file that is on your
>> machine?
>>
> I'm not quite sure what you mean by this.  MySQL won't connect you to a
> file on your machine.  It will connect you to a database server, which
> will possibly access files on your machine, but could just as easily
> access an in-memory database, that isn't stored in any files.
> 
> I've also never worked with adodb, but if you use MySQLdb, you do the
> following:
> 
> import MySQLdb as db
> 
> cur = db.connect(host='127.0.0.1', #or whatever your hosts address is
>                  user=username,
>                  passwd=password,
>                  db=database).cursor()
> cur.execute('SELECT * FROM table')
> cur.fetchall()
> 
> If adodb is dbapi 2 compliant, it may be as simple as s/MySQLdb/adodb/
> 
It won't be quite that simple, as adodb requires connection strings.

A good place to start would be

   http://www.carlprothman.net/Default.aspx?tabid=81

>> Also, could you please recommend to me a good resource to learn more
>> about classes and modules from? i don't understand half of the _init_
>> business that many sites mention. (This *is* something even a newbie
>> needs to learn, right?)
>>
> Try this chapter from Diving into Python:
> 
> http://www.diveintopython.org/object_oriented_framework/defining_classes.html
>> Thank you!
>>
Dive Into Python might seem intimidating at first glance, but it's worth 
persevering with.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline




More information about the Python-list mailing list