Lỗi resource with identifier version not found linenumber 0 năm 2024

We can search odbc in our local program and check for version of odbc. In my case I have version 17 and 11 so. I have used 17 in connection string

'DRIVER={ODBC Driver 17 for SQL Server}'

answered Nov 12, 2020 at 12:50

SanjivSanjiv

1,1102 gold badges12 silver badges31 bronze badges

5

I've met same problem and fixed it changing connection string like below. Write

'DRIVER={ODBC Driver 13 for SQL Server}'

instead of

'DRIVER={SQL Server}'

wjandrea

29.8k9 gold badges63 silver badges85 bronze badges

answered Mar 23, 2018 at 1:40

MilMil

3212 silver badges3 bronze badges

4

I'm using Django 2.2

and got the same error while connecting to sql-server 2012. Spent lot of time to solve this issue and finally this worked.

I changed driver to

'driver': 'SQL Server Native Client 11.0'

and it worked.

answered Sep 6, 2019 at 9:10

2

Local Ms Sql database server need or {ODBC driver 17 for SQL Server} Azure Sql Database need{ODBC driver 13 for SQL SERVER}

Check installed drivers here => Installed ODBC Drivers

Format for connection to Azure Sql Database is :

import pyodbc
conn = pyodbc.connect['DRIVER={ODBC Driver 13 for SQL Server};'
                      'SERVER=tcp:nameServer.database.windows.net,1433;'
                      'DATABASE=Name database; UID=name; PWD=password;']

Format for connection to Ms SQL Databse Local is:

import pyodbc
conn = pyodbc.connect['DRIVER={ODBC Driver 17 for SQL Server};'
                      'SERVER=server.name;' // example Doctor-Notebook\\MSSQLEXPRESS
                      'DATABASE=database.name; Trusted_connection = yes']

Ynjxsjmh

28.9k7 gold badges36 silver badges54 bronze badges

answered Mar 13, 2021 at 14:16

MaherottiMaherotti

1032 silver badges7 bronze badges

I faced this issue and was looking for the solution. Finally I was trying all the options from the //github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-Windows , and for my MSSQL 12 only "{ODBC Driver 11 for SQL Server}" works. Just try it one by one. And the second important thing you have to get correct server name, because I thought preciously that I need to set \SQLEXPRESS in all of the cases, but found out that you have to set EXACTLY what you see in the server properties. Example on the screenshot:

answered May 21, 2019 at 8:58

UstinUstin

5686 silver badges19 bronze badges

4

You could try:

import pyodbc
# Using a DSN
cnxn = pyodbc.connect['DSN=odbc_datasource_name;UID=db_user_id;PWD=db_password']

Note: You will need to know the "odbc_datasource_name". In Windows you can search for ODBC Data Sources. The name will look something like this:

answered Dec 10, 2018 at 19:05

dady7749dady7749

1253 silver badges11 bronze badges

1

The below code works magic.

 SQLALCHEMY_DATABASE_URI = "mssql+pyodbc:///?driver=SQL Server Native Client 11.0?trusted_connection=yes?UID" \
                              "=?PWD="

xiawi

1,7824 gold badges19 silver badges21 bronze badges

answered May 26, 2020 at 8:06

Below connection string is working

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

0

answered Sep 24, 2019 at 17:52

In my case, I was using wrong drivers to connect to Microsft SQL server

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

1

I noticed that I was using "SQL server" as a driver for connecting to "Microsoft SQL server". I installed new ODBC driver and it worked well.

Don't use "MySQL ODBC Unicode/ANSI driver" to connect to Microsoft SQL servers. Instead install latest [or older as per requirement] from here

Also make sure that SQL server is allowed to accept remote connections.

answered Sep 6, 2023 at 8:16

Apart from the other answers, that considered the connection string itself, it might simply be necessary to download the correct odbc driver. My client just faced this issue when executing a python app, that required it. you can check this by pressing windows + typing "odbc". the correct driver should appear in the drivers tab.

answered Feb 27, 2020 at 17:04

Tarek SalhaTarek Salha

3273 silver badges12 bronze badges

Have you installed any product of SQL in your system machine ? You can download and install "ODBC Driver 13[or any version] for SQL Server" and try to run if you havent alerady done.

answered May 5, 2020 at 10:28

1

Create a DSN something like this [ASEDEV] for your connection and try to use DSN instead of DRIVER like below:

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

2

answered Jun 30, 2020 at 8:44

I was facing the same issue whole day wasted and I tried all possible

conn_str = [
    r'DRIVER = {SQL Server};'
    r'SERVER=[local]\SQLEXPRESS;'
    r'DATABASE=myDb;'
    r'Trusted_Connection=yes;'
]
cnxn = pyodbc.connect[conn_str]

2 values

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

3

In place of

conn_str = [
    r'DRIVER = {SQL Server};'
    r'SERVER=[local]\SQLEXPRESS;'
    r'DATABASE=myDb;'
    r'Trusted_Connection=yes;'
]
cnxn = pyodbc.connect[conn_str]

3 we can try these option one by one or just you can use with you corresponding setting, somehow in my case the last one works :]

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

4

answered Dec 11, 2020 at 5:19

sakulachi8sakulachi8

1902 silver badges11 bronze badges

answered Apr 5, 2021 at 0:20

Ricardo VilaçaRicardo Vilaça

9261 gold badge8 silver badges18 bronze badges

4

In my case, the exact same error was caused by the lack of the drivers on Windows Server 2019 Datacenter running in an Azure virtual machine.

As soon as I installed the drivers from //www.microsoft.com/en-us/download/details.aspx?id=56567, the issue was gone.

answered Sep 15, 2021 at 15:45

Julio S.Julio S.

9601 gold badge13 silver badges28 bronze badges

Try below:

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

5

RobC

23.8k20 gold badges75 silver badges80 bronze badges

answered Sep 16, 2019 at 8:34

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

6

it worked for me; you need to install driver from here

//learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver15

or [in ubuntu]

conn_str = [
    r'DRIVER = {SQL Server};'
    r'SERVER=[local]\SQLEXPRESS;'
    r'DATABASE=myDb;'
    r'Trusted_Connection=yes;'
]
cnxn = pyodbc.connect[conn_str]

4 if you get an error with

conn_str = [
    r'DRIVER = {SQL Server};'
    r'SERVER=[local]\SQLEXPRESS;'
    r'DATABASE=myDb;'
    r'Trusted_Connection=yes;'
]
cnxn = pyodbc.connect[conn_str]

5

answered Jan 25, 2022 at 15:52

None of the above worked for me. What did work for me was the following:

Instead of passing a connection string like this:

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

7

I passed the connection details as following:

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

8

Hope this helps someone.

answered Apr 4, 2023 at 7:31

My issue; trying to connect using MFA and my email, which has the permissions for this database. I also made sure that I could connect to the database in the first place, just to be sure.

First of all, look at all the drivers:

connection = pyodbc.connect['Driver = {SQL Server};Server=SIWSQL43A\SIMSSPROD43A;'
    pyodbc.Error: ['IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [0] [SQLDriverConnect]']

9

Now you can set up your connection string; I had the list of available drivers. For Azure Authentication [now Microsoft Entra Id] this code worked for me:

conn_str = [
    r'DRIVER = {SQL Server};'
    r'SERVER=[local]\SQLEXPRESS;'
    r'DATABASE=myDb;'
    r'Trusted_Connection=yes;'
]
cnxn = pyodbc.connect[conn_str]

0

This opened a small window asking me to connect and add the Authentication code.

answered Dec 14, 2023 at 4:16

Hila DGHila DG

6885 silver badges13 bronze badges

if any one are trying to access the database which is hosted in azure then try to give the driver as ODBC Driver 17 for SQL Server

answered Oct 22, 2020 at 3:43

if your system is 64 bit then make sure you have both python and sql 64 bit you will find both on the google how to download 64 bit python

Chủ Đề