Python Forum
ssues with importing data from ODBC
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ssues with importing data from ODBC
#2
I don't have experience with this so I might be wrong, but you say this works: abc <- odbcConnect("asa"). So what is "asa"? I guess it is a DSN. And apparently you do not have to specify username and password, so I guess this information is stored in the DSN.
Then in your python source you say:
1
2
server = 'asa'
db = 'dbo.tblCountry'
But in the previous (working) example, "dbo.tblCountry" was the name of a table. Not a database. So to do the same as in the (working) example I guess you should do:
1
conn = pyodbc.connect("DSN=asa")
Note: the parameter you specify is just passed through to the ODBC handler, so it is one quoted parameter. If you need to pass more parameters, it should still be one parameter in Python:
1
conn = pyodbc.connect("DSN=MSSQLServerDatabase;UID=myuid;PWD=mypwd")
(Don't add unnecessary spaces.)
Reply


Messages In This Thread
ssues with importing data from ODBC - by Slavek_d - Jan-31-2022, 09:06 AM
RE: ssues with importing data from ODBC - by ibreeden - Feb-01-2022, 09:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Importing python data to Textfile or CSV yanDvator 0 2,257 Aug-02-2020, 06:58 AM
Last Post: yanDvator
  Importing data from a text file into an SQLite database with Python macieju1974 7 6,295 Jun-29-2020, 08:51 PM
Last Post: buran
  ODBC iPhone to PC KipCarter 0 1,918 Feb-19-2020, 11:53 AM
Last Post: KipCarter
  accessing Sybase (ASE and/or Anywhere) via ODBC... on Linux zatlas1 0 3,540 Jan-31-2019, 06:48 PM
Last Post: zatlas1
  Importing csv data into sql lite cant figure it out. jimmyvegas29 5 4,939 Jul-16-2018, 02:02 AM
Last Post: jimmyvegas29
  how do I successfully use PDO with my ODBC for MSSQL? cyberion1985 3 8,211 Jun-26-2018, 04:44 PM
Last Post: Maverick494
  Importing data Scott 4 6,572 May-12-2018, 11:22 AM
Last Post: snippsat
  ODBC Not Working Bonediggler 3 3,633 Sep-28-2017, 06:18 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020