pyodbc

pyodbc.Error: ORA-12560: TNS:protocol adapter error (12560) (SQLDriverConnect) in python. But i am able to connect using sqlplus

北战南征 提交于 2019-12-11 17:16:47
问题 I am able to connect to oracle DB using following commands in sqlplus sqlplus user/pass@pdw1s_default Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production and tnsping works properly tnsping pdw1s_default I tried to connect to oracle using python and i tried below connection strings. But I am getting same error. Both Oracleclient and python is 32bit version. Driver={Oracle in OraClient12Home1};dbq = pdw1s_default;Uid=user;Pwd=pass; Driver={Oracle in

Django Apache MsSQL connection timeout

江枫思渺然 提交于 2019-12-11 16:56:05
问题 I am trying to Django with MS SQL Server on CentOS 7 using Apache mod_wsgi. I'm able to run the Django app using python manage.py runserver 0.0.0.0:8000 and navigate to my grappeli admin page. However, when I run using Apache, the home site loads up just fine but then I get OperationalError: ('HYT00', u'[HYT00] [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)') when I attempt to navigate to the admin page. It's strange that runserver would work

pyodbc AccessDB TypeError: ('Params must be in a list, tuple, or Row', 'HY000')

本小妞迷上赌 提交于 2019-12-11 16:44:39
问题 Running Python 3.7.2 32 bit on Windows 7 and using pyodbc package 4.0.25-cp27 32bit I have tried multiple ways of passing through the params and keep getting the above error: TypeError: ('Params must be in a list, tuple, or Row', 'HY000') my inputfile is a txt file containing this: TEST ,EU ,Totals , 30, 0.61, 0.00000000,GOLD ,01/03/2019, TEST ,EU ,SubTotals , 40, 0.63, 0.00000000,GOLD ,01/03/2019, A few versions: qry = """INSERT INTO newtable ([Col1], [Col2], [Col3], [Col4], [Col5], [Col6],

How to update a db table from pandas dataset with sqlalchemy

浪尽此生 提交于 2019-12-11 15:24:24
问题 I need to update a table in a MSSQL database. The dimension of the table doesn't allow to load the table in memory, modify the dataframe and rewrite it back. I also need to update only one column at a time so I cannot use the solution proposed in this topic (ie the solution proposes a delete operation of the interested rows, impossible for me cause I can update only one column at time) So I need to perform something like an update-from query Update mytable set mycolumn = dfcolumn from df

Error while loading json in Python

吃可爱长大的小学妹 提交于 2019-12-11 14:19:14
问题 I'm parsing JSON in python but couldn't figure out the correct way to get the data. I'm accessing JSON data from sql table called "table1" in python Parsing the data and updating those records back in " table1 ". So this is my sql table R_GEOCODE_ID JSON Street_Numb Street_Name Route sublocality Country ... 12 <json_objects> NA NA NA NA NA ... 40 <json_objects> NA NA NA NA NA ... 30 <json_objects> NA NA NA NA NA ... In above table the actual JSON data could not be accumulated so I'm pasting

Importing pyodbc results as Internal server error in Apache HTTP Server

≡放荡痞女 提交于 2019-12-11 14:06:41
问题 Executing the cmd as c:\>pip install pyodbc " pyodbc.cp36-win32.pyd " file will be created Collecting pyodbc Using cached pyodbc-4.0.21-cp36-cp36m-win32.whl Installing collected packages: pyodbc Successfully installed pyodbc-4.0.21 When I try to run in Apache24 Server the below code results in Internal Server Error import pyodbc cnxn = pyodbc.connect("Driver={ODBC Driver 13 for SQL Server};" "Server=DESKTOP;" "Database=demo2017;" "Trusted_Connection=yes;") cursor = cnxn.cursor() cursor

Need to skip line containing “Value Error”

大憨熊 提交于 2019-12-11 12:56:45
问题 I'm trying to extract some legacy data from a Teradata server, but some of the records contain weird characters that don't register in python, such as "U+ffffffc2". Currently, I'm using pyodbc to extract the data from Teradata Placing the results into a numpy array (because when I put it directly into pandas, It interprets all of the columns as a single column of type string) Then I turn the numpy array into a pandas dataframe to change things like Decimal("09809") and Date("2015,11,14") into

Error while importing file into DB2 from python script

微笑、不失礼 提交于 2019-12-11 12:42:19
问题 Getting the below error while trying to import a ^ delimited file into a DB2 database using python 2.4.3. Error: Traceback (most recent call last): File "C:\Python25\Usefulscripts\order.py", line 89, in <module> load_order_stack() File "C:\Python25\Usefulscripts\order.py", line 75, in load_order_stack conn2.execute(importTmp) ProgrammingError: ('42601', '[42601] [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "orders_extract" was found following "import from ". Code: import

Using Microsoft Access SQL operators in Python ODBC

一个人想着一个人 提交于 2019-12-11 12:23:51
问题 Short version: When I try to use Access's DatePart function via ODBC, it cannot be resolved. Longer version: I have a Microsoft Access query which returns rows with a timestamp and a score. I want to sort it by day and then by score - effectively a high-score table for the day. For want of a better function, I used the DatePart function to extract each of the Year, Month and Day from the timestamp, and ORDER BY them followed by Score. In Microsoft Access, the query works beautifully. However,

what does ? mean in python pyodbc module

偶尔善良 提交于 2019-12-11 12:12:12
问题 import pyodbc cursor.execute("INSERT INTO Testing_Param(Seed_Number,Cycle_Name) VALUES (?,?)",('0','CoupleIn')) what does the "?" mean in the code? When I try to replace the ? to %s for the "CoupleIn" which is the string and %d for the "0", why does it appear error message: pyodbc.ProgrammingError: ('The SQL contains 0 parameter markers, but 2 parameters were supplied', 'HY000') I am new to the pyodbc module to do transfering data from Python into Microsoft SQL server 回答1: It is a place