help - inserting values into database tables

mylinuxboxroot aries at bitstream.net
Wed Feb 20 23:41:08 CET 2002


Hey chajadan,
Well I tried clicking on the ODBC icon in  control panel, I get the error
saying
I need to reinstall the ODBC Components......what a bummer.
I don't have the install CD for windows 98.
Boy, if I ever get it going I'm going to give it full thrusters and
afterburners !!!
Cause I know now it can be done.

I did however setup the ODBC on a windows 95 system, and it appears that
I set it up correctly.  I gave it a "System DSN"  to the Manufacturers.mdb
...but
running the script I get an error something about "system 7.0....  in Login"
I set the "System DSN" up with no user ID or password so I wouldn't have
to worry about that in my script file.  But it seems it gives that Login
error.
I wonder if I need to put SHARE.EXE thing in my autoexec.bat file ???

I could send you the whole error message if you want ???  on the win95 sys.
ON both systems neither one has ms-access installed just so you know.
But I did put the small database files *.mdb in the directory that contains
my script
files.

Well I will chat with ya later.....Sega,
Joe F.

chajadan <python at chajadan.net> wrote in message
news:mailman.1014086793.5272.python-list at python.org...
> 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
>
>





More information about the Python-list mailing list