Python Forum
how do I successfully use PDO with my ODBC for MSSQL?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do I successfully use PDO with my ODBC for MSSQL?
#3
Smile oops, sorry !

Then python! Cool The above screenshots should still be valid. I actually started with python and then moved to PHP. The below basic code should just simply see if it can make a connection. So, THANK YOU as I was able to use python to get it working !!! And who knows, this might help in fixing the PHP too !

import pyodbc

con = ""

try:
    con = pyodbc.connect(
        r'DRIVER={ODBC Driver 11 for SQL Server};'
        r'SERVER=SERVER\SRVINSTANCE;'
        r'DATABASE=dbname;'
        r'UID=username;'
        r'PWD=password;'
        )
except pyodbc.Error, err:
    print err

if con:
       
    cur = con.cursor()
    
    con.close()
    
    print "yes! it works!"
Reply


Messages In This Thread
RE: how do I successfully use PDO with my ODBC for MSSQL? - by cyberion1985 - Jun-26-2018, 09:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python connect to mssql wailoonho 7 2,051 Dec-07-2023, 02:06 AM
Last Post: wailoonho
Sad Can anyone help me successfully run this code? TheMouseAvenger 26 4,280 Sep-22-2023, 02:51 PM
Last Post: snippsat
  MSSQL query not working in Python kat35601 0 986 Apr-12-2022, 06:44 PM
Last Post: kat35601
  from MSSQL to excel kat35601 1 1,758 Apr-11-2022, 06:19 PM
Last Post: buran
  ssues with importing data from ODBC Slavek_d 1 1,497 Feb-01-2022, 09:57 AM
Last Post: ibreeden
  ODBC iPhone to PC KipCarter 0 1,576 Feb-19-2020, 11:53 AM
Last Post: KipCarter
  accessing Sybase (ASE and/or Anywhere) via ODBC... on Linux zatlas1 0 2,962 Jan-31-2019, 06:48 PM
Last Post: zatlas1
  [split] How to insert JSON into MSSQL gehrenfeld 3 3,413 Jan-27-2019, 06:20 PM
Last Post: micseydel
  How to insert JSON into MSSQL raysefo 2 4,226 Jan-27-2019, 06:17 PM
Last Post: micseydel
  Interface Arduino and MSSQL using Python MichaelDean 0 2,990 Nov-18-2018, 05:00 PM
Last Post: MichaelDean

Forum Jump:

User Panel Messages

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