I am trying to implement OData over odbc connection layer, I am currently not able to get data as IQueryable from ODBC driver (ODBC connection is for Sql Server)
Is there any driver that can return data as IQueryable through ODBC Connection?
The benefit of IQueryables that they don't actually execute on the database. IQueryables are just in-memory representations of a query that one can execute on demand to get results. It's a flavor of a lazy loaded list.
Given this I don't think that you are necessarily asking the right question. Does that make sense?
Related
I am working on my first SSIS package that is pulling data from one on-premise SQL Server instance doing some transformations and writing it to a separate on-premise SQL Server instance.
While working with the package in my SSDT project all of my tasks run and work correctly.
Once I deploy the package to SQL Server the ADO.NET connection to the source database fails.
The package is deployed on the destination SQL Server instance.
There is a data flow task earlier in the package that uses an OLE DB connection which is successful and uses the same SQL Authentication username and password combination.
I get the error:
Read Group Membership:Error: Failed to acquire connection "sourcedb.testtable". Connection may not be configured correctly or you may not have the right permissions on this connection.
One thought is that I may need to configure an ADO.NET connection provider on the source database.
As this is my first foray into SSIS I expect the fix is trivial, I just can't get there.
Update with solution:
I resolved the issue by using an OLE DB connection rather than the ADO.NET. I didn't realize I could still sue the results from an OLE DB connected query to populate an ADO Enumerator.
Changed to use an OLE DB connection rather than an ADO.NET connection.
I had thought I needed an ADO.NET connection to populate my data and use it in a foreach as an ADO Enumerator.
I am experimenting with executing SQL Server stored procedures on a SQL Server back end from Access via DAO / ADO.
I can get it working quite well in DAO by using a pass-through query with a connection string to an ODBC data source
When I try to use the same connection string on an ADO Connection object however, I just get the message:
Error -2147467259: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (Microsoft OLE DB Provider for ODBC Drivers)
The connection string that worked with DAO was a pointer to a DSN file: "ODBC;FILEDSN=RISCGen2.dsn".
Thinking that ADO might not be able to digest this, I tried replacing the string with the relevant content from the DSN file, namely:
“ODBC;DRIVER={ODBC Driver 11 for SQL Server};UID=my.loginid;PWD=mypassword;SERVER=WYNRISC08;Database=RISCGen2”.
However, I am still getting the same error.
Can someone spot where I am going wrong with this? Thanks in advance.
ADDENDUM
Dan Guzman has answered the question I posed. The problem has now become one of understanding certain messy details about ADO's way of doing things. I am thinking I will need to ask another question to deal with it...New question posted : Execute SQL stored procedure from VBA and retrieve all messages and result sets
ODBC;DRIVER={ODBC Driver 11 for SQL
Server};UID=my.loginid;PWD=mypassword;SERVER=WYNRISC08;Database=RISCGen2
Omit the extraneous ODBC specification:
DRIVER={ODBC Driver 11 for SQL Server};UID=my.loginid;PWD=mypassword;SERVER=WYNRISC08;Database=RISCGen2
Note that classic ADO is natively OLE DB and uses the Microsoft OLE DB Provider for ODBC Drivers (MSDASQL) to use ODBC drivers. It would be best to use an OLE DB provider instead. You could use the legacy SQL Server OLE DB provider that ships with Windows (SQLOLEDB) but it would be best to use the latest MSOLEDBSQL driver as of this writing. The connection string for that is:
Provider=MSOLEDBSQL;UID=my.loginid;PWD=mypassword;SERVER=WYNRISC08;Database=RISCGen2
You might need to specify DataTypeCompatibility=80 if you use newer SQL data types because ADO classic is a mature API that hasn't been enhanced since SQL Server 2000 and is unaware the data types added since.
Just linked SQL Server 2008 R2 Express to iSeries and can't see my files. I can query them though. Text returned as 0xD4F3F1F7F9F1F0 instead of something like M123450 (that's a work order number). Using the IDM DB2 for IBMDA400 OLE DB Provider.
I tried using a connection string that works for other applications. I get errors:
TITLE: Microsoft SQL Server Management Studio
The linked server has been created but failed a connection test. Do
you want to keep the linked server?
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or
batch. (Microsoft.SqlServer.ConnectionInfo)
Cannot initialize the data source object of OLE DB provider "IBMDA400"
for linked server "S10A7F0P". (Microsoft SQL Server, Error: 7303)
Has anyone encountered anything like this? I'm reasonably new to the whole SQL server thing.
Thanks in advance!
M
The reason your data is returned as 0xD4F3F1F7F9F1F0 is that the text column was defined as CCSID 65535; which stands for binary data and so by default the DB doesn't translate it from EBCDIC to ASCII/Unicode.
You can see the CCSID of the various columns in a table by using the green screen DSPFFD command or the iNav GUI.
The best way to fix this it to ensure your text columns are tagged with the appropriate CCSID for your language (37 if US).
The alternative is to force the DB to translate text columns by using the "Force Translate" property of the OLEDB driver.
I have data in an Azure SQL database, which I would like to pull into an Excel sheet through the use of stored procedure(s) which require parameters.
However, I'm struggling to do this, as I cannot get it to work how it works with a local SQL server. Ordinarily this is done through Microsoft Query, defining the connection to the database, and entering { CALL sproc (?) } and then using the Connections command to map a cell to the parameter.
I cannot set up a connection to the database in MS Query. When I enter the xxx.database.windows.net as the server, my username / password, and then try to switch to database I need to use I get the message below
Filling listbox failed:
SQLState: '37000'
SQL Server Error: 40511
[Microsoft][ODBC SQL Server Driver][SQL Server]Built-in function 'has_dbaccess' is not supported in this version of SQL Server.
Can anyone offer any assistance please?
Create a text file with the .DSN extension then add content like the following into it...
[ODBC]
DRIVER=SQL Server
SERVER=xxxxxxxx.database.windows.net,1234
APP=Microsoft Office 2010
WSID=NA
DATABASE=DB12345
[Microsoft Office]
UID=myUsername
PWD=myPassword
You can then just use this connection from Microsoft Query without dealing with the dialogs that are giving you grief.
I just figured this out with a combination of Youtube videos and dumb luck lol. You have to create an OBDC connection with Microsoft ODBC Driver 13.1 for SQL Server (or higher.) Make sure you connect and define the correct database in the ODBC object while entering in your Azure SQL connection info. Once that's done from within excel you can use MS Query to select that ODBC object and pull the data as you normally would.
Is it possible to have an ODBC connection and an ADO connection share the same underlying SQL Server connection, so that both are using the same SPID?
Currently I am using SQLDriverConnect and ADODB::_ConnectionPtr->Open. I can make these connections in either order, so perhaps it's possible to open one making use of the other?
(Language is C++, database is SQL Server 2005 & 2008. ODBC connection string uses a DSN. ADO uses Provider=SQLNCLI10, but either could be changed if required).
ADO uses OleDB, so you cannot share a connection with ODBC. Even if you use the ADO provider for ODBC you still wont be able, as no ADO API allows to wrap an existing ODBC connection handle.
But the real question is: why do you want to share the connection? The only valid reason is to enroll the two connections in the same transaction without doing a loopback local distributed transaction. Enrolling two distinct connections in the same transaction was always possible, this is how MTS and COM+ worked. The first connection uses sp_getbindtoken to get an enrolment token and the second connection uses sp_bindsession to enroll itself. This mechanism is on the endangered list of deprecation, but after all you are asking about the technology of the 90s... (ODBC, ADO)