django


[Solved]Getting error while connecting to database with freetds and odbc connection


Database settings
DATABASES= {
'default': {
'ENGINE': 'sql_server.pyodbc',
#'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
#'ENGINE': 'django.db.backends.sqlite3',
'NAME': 's',
'USER': 'test',
'PASSWORD': 'test',
'HOST': '*******',
'OPTIONS':{
'DRIVER' : 'FreeTDS',
'DSN' : 'sqlserver',
},
},
}
freetds.conf
[sqlserver]
host = *******
port = 1433
tds version = 8.0
client charset = UTF-8
etc/odbc.ini
[FreeTDS]
Description = FreeTDS
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/i386-linux-gnu/odbc/libtdsS.so
#Driver = /usr/local/lib/libtdsodbc.so
#Setup = /usr/local/lib/libtdsS.so
FileUsage = 1
CPTimeout =
CPResuse =
client charset = utf-8
[sqlserver]
Description = "test"
Driver = FreeTDS
#Servername = sqlserver
Server = *******
Port = 1433
Database =s
Trace = No
etc/odbcinst.ini
[FreeTDS]
Description=FreeTDS
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
#Driver=/usr/local/lib/libtdsodbc.so
#Setup=/usr/lib/odbc/libtdsS.so
DRIVER=FreeTDS
SERVER=*******
PORT=1433
DATABASE=s
UID=test
PWD=test
tds_version=7.2
[sqlserver]
Description=FreeTDS
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
#Driver=/usr/local/lib/libtdsodbc.so
#Setup=/usr/lib/odbc/libtdsS.so
#DRIVER=sqlserver
SERVER=*******
PORT=1433
DATABASE=s
UID=test
PWD=test
TDS_Version=8.0
usr/local/etc/odbc.ini
[FreeTDS]
Driver=/usr/local/lib/libtdsodbc.so
Servername=sqlserver
Description=FreeTDS SQL Server ODBC driver
Server=*******
Port=1433
Database=s
User=test
Password=test
Mars_Connection=No
Logging=No
LogFile=
QuotedId=Yes
AnsiNPW=Yes
Language=
Version7=No
ClientLB=No
Encrypt=Yes
TrustServerCertificate=No
PrivateKeyFile=
CertificateFile=
Entropy=
Failover_Partner=
VarMaxAsLong=No
DisguiseWide=No
DisguiseLong=No
DisguiseGuid=No
Trusted_Connection=No
Trusted_Domain=
tds_version = 8.0
[sqlserver]
Driver=/usr/local/lib/libtdsodbc.so
Servername=sqlserver
Description=FreeTDS SQL Server ODBC driver
Server=*******
Port=1433
Database=s
User=test
Password=test
Mars_Connection=No
Logging=No
LogFile=
QuotedId=Yes
AnsiNPW=Yes
Language=
Version7=No
ClientLB=No
Encrypt=Yes
TrustServerCertificate=No
PrivateKeyFile=
CertificateFile=
Entropy=
Failover_Partner=
VarMaxAsLong=No
DisguiseWide=No
DisguiseLong=No
DisguiseGuid=No
Trusted_Connection=No
Trusted_Domain=
usr/local/etc/odbcinst.ini
[FreeTDS]
Description=FreeTDS Driver
#Driver=/usr/local/lib/libtdsodbc.so
#Setup=/usr/lib/odbc/libtdsS.so
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/i386-linux-gnu/odbc/libtdsS.so
DRIVER=FreeTDS
SERVER=*******
PORT=1433
DATABASE=s
UID=test
PWD=test
tds_version=7.2
CPTimeout=
FileUsuage=1
[sqlserver]
Description=FreeTDS Driver
Driver=/usr/local/lib/libtdsodbc.so
#Setup=/usr/lib/odbc/libtdsS.so
#DRIVER=SQLServer
SERVER=*******
PORT=1433
DATABASE=s
UID=test
PWD=test
TDS_Version=8.0
Error(Error page)
conn = Database.connect(connstr, unicode_results=unicode_results)
django.db.utils.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')
this is my database connection and i will append the odbc connection. please help me to rectify the error and connection to gets work. Thanks in Advance
You need to define your Data Source name under Databases settings which is in settings.py file.
DATABASES={
'default': {
'OPTIONS':{
'DRIVER':'FreeTDS',
'DSN': 'YOUR DSN NAME'
},
},
}

Related Links

How to display human time (x days ago, or now) in django admin?
Call admin function from another admin in django
Filter objects by exact position of character
Django image caching with S3
Correct way to set optional Django field to blank?
Specify a path other than templates folder for placement of templates
Django Annotation, Django doing a double outer left join
how to get the latest in django model
how to recuperate the data from a QuerySet with django
Django url NoReverseMatch error
Turn off imported app's AdminConfig in a Django Project
atomic transaction is not working django rest
Django: What do I pass in as self in the view.py if I am using a function from model.py?
In Django, how do I elegantly pass the object to which an inline is connected to an inline form?
Field is required on POST requets with GeoFeatureModelSerializer and ListCreateAPIView
Django + Backbone: underscore template for login / logout

Categories

HOME
spark-streaming
ns-3
angular-formly
zend-framework
camera
solver
grafana
tail
android-json
data-visualization
crystal-reports-2013
rcloud
p2p
endeca
fhir
android-intent
qsqlquery
entitymanager
dynamic-sql
atlassian-stash
imessage
mapstruct
sencha-touch
gmock
google-api-client
game-theory
slidetoggle
appirater
flooding
8051
wcag
gp
winpe
realm-mobile-platform
corenlp-server
python-2.6
dst
twos-complement
dynamic-jasper
zoomify
railstutorial.org
numberpicker
magento-1.9.3
angular-http
xmldocument
apache-spark-dataset
x++
magento-2.0.7
dtsearch
geotiff
custom-font
subnet
jqchart
pdf-conversion
bbpress
payload
universal-analytics
reachability
pytables
webjars
rspec2
android-dateutils
appscale
nservicebus5
nss
spreadjs
aurora
project-organization
sklearn-pandas
realsense
spring-retry
avisynth
computer-architecture
video-player
page.js
eoferror
branch-and-bound
alloy-ui
entity-framework-4.3
openbabel
boost-program-options
viewer
pseudo-class
rickshaw
gii
insight.database
verold
maven-scm
menubar
bin
dtmf
cmmi
sentestingkit
adobe-media-server
workflow-services
android-holo-everywhere
massive
qglwidget
cac
diagrams
uideviceorientation
tui
asynchronous-wcf-call
flvplayback
business-model
wspbuilder
pnrp

Resources

Encrypt Message