Database setup

66 views
Skip to first unread message

Markus Christen

unread,
Oct 29, 2012, 4:40:01 AM10/29/12
to django...@googlegroups.com
Good Morning
First i made an odbc connect liek this:
 
---------------------------------------------------------
import pyodbc
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=MAURITIUS;DATABASE=baan5c;UID=***;PWD=*****')
cursor = cnxn.cursor()
cursor.execute("SELECT x.t_name, y.t_mail FROM tttaad200000 as x, tttcmf200000 as y WHERE (x.t_name = y.t_name) AND (x.t_user = 'muster')")
row = cursor.fetchall()
if row:
 print row
--------------------------------------------------------
This gave me out the correct data (name + e-mail) from a user.
I tryed now to use this database in the Admin site, but i'm to stupid to implements this correct into the Database Setup.
The server is not on my computer, it is in the same LAN
 
Can someone help me please?

Markus Christen

unread,
Oct 29, 2012, 5:12:41 AM10/29/12
to django...@googlegroups.com
EDIT:
I have a second to implements. Its a Lotus Notes DB, and for the userauth there is a file on my computer.
I tryed it with  the odbc of IBM:
 
-------------------------------------------------------
import pyodbc
conn = pyodbc.connect('DRIVER={Lotus Notes SQL Driver (*.nsf)};SERVER=Wind/Sefar;DATABASE=Kopie_SCHSales.nsf;UID=***/M/CHTHA/Sefar;PWD=*****');
-------------------------------------------------------
 
I can connect, but i cant read out data, thats my i try with this Admin Site.
Do someone know how to implements?
I know how to make Multiple DB's...

Tom Evans

unread,
Oct 29, 2012, 12:24:22 PM10/29/12
to django...@googlegroups.com
On Mon, Oct 29, 2012 at 3:54 PM, Onyx Fields
<tenfinger...@gmail.com> wrote:
> I wish I could help as well, but I just started with the tutorial (HERE),
> and I am not following the Database Setup either. Perhaps someone who is
> more familiar with it could explain it in layman's terms for a noob like
> myself?
>

Are you also trying to set up an ODBC connection to Lotus Notes? If
not ,starting a thread about your own issues would be more
appropriate.

Cheers

Tom

Markus Christen

unread,
Oct 30, 2012, 3:27:16 AM10/30/12
to django...@googlegroups.com
What i know now:
 
-------------------------------------- 
 
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'baan5c',
        'USER': '***',
        'PASSWORD': '*****',
        'HOST': 'MAURITIUS',
        'PORT': '1433',
    }
}
-------------------------------------- 
 
This will works, if my DB is a mysql. But I use MsSql.
The pyodbc is installed and i made connects over it, to the DB. But for settings.py, i cant find the base.py of this pyodbc.
Any idea where i can find it?

Jirka Vejrazka

unread,
Oct 30, 2012, 5:54:20 AM10/30/12
to django...@googlegroups.com
Hi Markus,

I don't think you mentioned what OS you use on your machine with Django.

If it helps, I had this in my settings.py when connecting to MS SQL
database from Linux

'mssql': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'mdb',
'USER': USERNAME,
'PASSWORD': PASSWORD,
'OPTIONS': {
'driver': 'FreeTDS',
'encoding': 'latin1', # see django-pyodbc issue #24
# UAPM uses SQL_Latin1_General_CP1_CI_AS
'dsn': 'mssql', # see /etc/odbc.ini
},

There was some extra client libraries installed and a configuration
had to be do be done for system ODBC. Can't help you there, memory
failing :)

HTH

Jirka
Reply all
Reply to author
Forward
0 new messages