help - inserting values into database tables

chajadan python at chajadan.net
Tue Feb 19 03:16:09 EST 2002


It seems I have ISDN on the brain, because I changed the correct "DNS" to 
the incorrect "DSN" partway through and never went back ;)

--chajadan

At 09:57 PM 2/18/02 -0800, you wrote:
>Hi Joe =)
>
>Your problem shouldn't be too hard to fix.
>
>Using odbc, you can't open the database file directly like that, since 
>odbc supports so many different database standards, it needs to know which one.
>
>This requires a DNS. In order to set up a DNS for MS Access, just go to 
>your control panel, and you should have an option called "OBDC 
>Datasources" or similar. Click that, and it will show you your current 
>DSNs. There are several types of DSNs, but you will want to make this file 
>a System DSN, so click that tab. Select New, and choose the correct 
>database driver, in this case MS Access. Then you have to name the DSN, 
>anything you'd like (avoid spaces), chose a login/password or leave that 
>blank, and finally show it the database file this whole DSN should be 
>referring to.
>
>Then, you can odbc.odbc("myDsnName")
>
>=)
>
>Let me know if you have any other questions and I'll try to help. I work 
>on Win98, so some of what I described may look slightly different under 
>XP, but it should be there.
>
>Good luck!
>
>--chajadan
>aka charlie
>
>At 06:35 PM 2/18/02 -0600, you wrote:
>
>>Hi again,
>>Just wondering if you can help?
>>
>>I installed the python ver 2.0(from CD)for windowsX on a windows98
>>system.  Then I installed the windows32all stuff.
>>So are the dbi and the odbc modules should now be installed
>>on my system now, or do I need some other package ??????
>>
>>It seems I can import the dbi then the odbc with no errors...
>>But my simple script below won't run; has an error that I
>>don't understand ???????
>>
>>I am running from the command line, heres my environ stuff
>>******* Do I need to put in another path to Lib ?????
>>
>>COMSPEC=C:\WINDOWS\COMMAND.COM
>>windir=C:\WINDOWS
>>PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JDK11~1.8\BIN;C:\PYTHON20;
>>
>>******** Heres the error I get upon running from prompt
>>
>>C:\codepy>python conntest.py
>>
>>Traceback (most recent call last):
>>   File "conntest.py", line 8, in ?
>>     conn = odbc.odbc("c:\\codepy\\Manufacturers.mdb")
>>dbi.operation-error: [Microsoft][ODBC Driver Manager] Data source name not
>>found and no default driver specified in LOGIN
>>
>>The Manufacturers.mdb is the ms-access database of ver office XP
>>2002.  It is just a small database with a small table in it.
>>Very simple kind.  The file is in that codepy directory also.
>>So I don't understand ?????????????????
>>What is DSN, does it allow for a ms-access file??????????
>>
>>Well anyways heres my test database connection script, I am
>>just trying to connect and print some output from the database.
>>I think I am doing this correct but not sure ??????????
>>
>>The script:  conntest.py listing
>>#! /usr/bin/env python    #not needed for windowspython
>>
>>#test script to connect to a ms-access database
>>
>>import dbi
>>import odbc
>>
>>conn = odbc.odbc("c:\\codepy\\Manufacturers.mdb")
>>rs = conn.cursor()
>>rs.execute("select * from ManufName")
>>print rs.description
>>
>>rs.close
>>conn.close
>>
>>Can you shine any light my way ???????????
>>
>>Thank you (working on a windows system today(UGH...)),
>>Joe F.
>>#####
>>
>>----- Original Message -----
>>From: chajadan <python at chajadan.net>
>>Newsgroups: comp.lang.python
>>Sent: Monday, February 18, 2002 2:34 PM
>>Subject: Re: help - inserting values into database tables
>>
>>
>> > I always use PythonWin, part of the win32all distribution. It's a
>> > color-coded ide, with a basic syntax check, and has one nifty advantage
>> > over any other input editor I've tried: when you call a function, it takes
>> > the document strings and actually gives you a little note about what kind
>> > of input it's expecting!
>> >
>> > So all in all it should be the same thing as it ever was, but now in the
>> > environment your particular task seems to ask for. The only "new" things
>> > will be the other possible windows-only features you might want to learn
>> > and use in your time on windows.
>> >
>> > Happy computing!
>> >
>> > --chajadan
>> >
>> > At 08:15 AM 2/18/02 -0600, mylinuxboxroot wrote:
>> > >Hey thanks,
>> > >This is great, and I have the project now that it will be developed on a
>> > >windows
>> > >server so I guess I don't need to worry about going from linux to the
>> > >MS-Access
>> > >database.  I will develop it right on the server using the win32all
>> > >distribution that
>>
>>snip
>
>
>--
>http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list