Inserting using clause location in Sybase IQ - sybase

I'm using Sybase IQ 16 and I'm trying to insert data from a Sybase ASE 15.7
I defined an ODBC dsn for Sybase ASE and the connection test is positive,
the name of the DSN is EMS_SERVER_ems, this dsn is defined on database ems,
I created the server within Sybase IQ using the command create server:
create server EMS_SERVER
CLASS 'aseodbc'
using 'DRIVER=Adaptive Server Enterprise;dsn=EMS_SERVER_ems';
I also created the external login
create externlogin DBA to EMS_SERVER
REMOTE LOGIN DBA identified by sql
but when I'm trying the command :
insert MyFirstIqTable
location 'EMS_SERVER.ems' {select * from my_table}
then I get the error :
Could not execute statement.
CtLibrary Error: 44, Severity: 0, Origin: 1, Layer: 4
Error Message:
ct_connect(): protocol specific layer: external error: The attempt to connect to the server failed.
OS Error: 0, OS Message:
(hqmlib\hqm_con.cxx 199)
SQLCODE=-1003002, ODBC 3 State="HY000"
Does someone has an idea ?

Got it, this was because my external login was wrongly defined.
It's working like a charm !

Related

SQL Server -- CREATE EXTERNAL FILE FORMAT to query Parquet files via Polybase -- failing due to TCP error

Context: I'm trying to use SQL Server's Polybase to query data in parquet files. One of the steps required to do so is to create an external file format that maps to parquet. MSDN provides SQL sample below.
CREATE EXTERNAL FILE FORMAT parquet_file_format
WITH (
FORMAT_TYPE = PARQUET,
--DATA_COMPRESSION = 'org.apache.hadoop.io.compress.SnappyCodec'
DATA_COMPRESSION = 'org.apache.hadoop.io.compress.GzipCodec'
);
When I execute it I get the following error.
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "Login timeout expired".
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 10061, Level 16, State 1, Line 40
TCP Provider: No connection could be made because the target machine actively refused it.
I've tried enabling TCP network protocol
and also tried configuring the remote access server configuration option neither of which resolve the error.
EXEC sp_configure 'remote access', 0 ;
GO
RECONFIGURE ;
GO
Question: Can someone please point me in the right direction, or tell me what I'm doing wrong?
Turns out issue was Polybase services weren't running. I was able to run them in the sql server configuraion manager under sql server network configuration. This was helpful: https://www.sqlservercentral.com/forums/topic/polybase-syntax-error

Cannot generate SSPI context when creating External Data Source in SQL 2019

I'm trying to create an External Data Source for PolyBase via ODBC connectors in SQL Server 2019, but I'm getting the error:
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "Cannot generate SSPI context".
Msg -2146893042, Level 16, State 1, Line 11
SQL Server Network Interfaces: No credentials are available in the security package
I am using SSMS 18.4 and I'm running the following command:
CREATE EXTERNAL DATA SOURCE TEST
WITH (
LOCATION = 'odbc://sap.company.com',
CONNECTION_OPTIONS = 'DSN=SAP',
CREDENTIAL = my_creds
);
I did a fair amount of reading and it seems like the error can be 1 of many things. But I can't really find anything where it relates to External Data Sources.
Any advice or guesses will be appreciated.
I'm running SQL 2019 Developer (RTM) 64 bit on Windows 10
I have an ODBC entry called SAP that connects succesfully
my_creds has been created in SQL with SAP user name and password.
My SQL 2019 PolyBase Engine service is running under Network Service (same with the PolyBase Data Movement service).
TCP/IP has been enabled on the PolyBase service.

Create Database link to MS SQL Server on Oracle database

Please help.. I need to connect to a SQL Server database (B) from an Oracle database (A) which are both on Windows server machines. Here is what I did.
System DS created on (A):-
Name: ISECWM
Driver: ODBC Driver 11 for SQL Server
Test Results:
Microsoft ODBC Driver for SQL Server Version 12.00.5543
Running connectivity tests...
Attempting connection Connection established Verifying option settings
Disconnecting from server
TESTS COMPLETED SUCCESSFULLY!
$ORACLE_HOME/hs/admin/initISECWM.ora file contains
HS_FDS_CONNECT_INFO = ISECWM
HS_FDS_TRACE_LEVEL = OFF
$ORACLE_HOME/network/admin/listener.ora updated:-
SID_LIST_LISTENER = (SID_LIST = (SID_DESC =
(SID_NAME=ISECWM)
(ORACLE_HOME=c:\oracle\11g)
(PROGRAM=dg4odbc)
) )
$ORACLE_HOME/network/admin/tnsnames.ora updated:-
WORLDMAP.DBL = (DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=SERVER A HOSTNAME)(PORT=1521))
(CONNECT_DATA=(SID=ISECWM)) (HS=OK) )
Database link created:-
CREATE PUBLIC DATABASE LINK TSTDBLINK CONNECT TO "sql server
username" IDENTIFIED BY "sql server password" USING 'WORLDMAP.DBL';
Tested the database link with:-
select * from dual#TSTDBLINK; --gives the error
Error:-
ORA-28513: internal error in heterogeneous remote agent ORA-02063:
preceding line from TSTDBLINK
28513. 00000 - "internal error in heterogeneous remote agent"
*Cause: An internal error has occurred in the Oracle remote agent
supporting a heterogeneous database link.
*Action: Make a note of how the error was produced and contact the
customer support representative of the agent vendor. Error at Line: 7 Column: 20
Ah, finally Oracle helped me with the issue.
It seems I had 2 homes, I put the initISECWM.ora in the wrong Oracle home.
Just copied and pasted it in the other home/hs/admin/ and it worked like a wonder! Voila!

How to access a database file .MDF from R

I am trying to connect to the AdventureWorks2012 database (MDF file) from R. The file is stored on my local computer. I have been able to setup SQl Server and the SQL Server Management Studio.
In Server Management Studio I have my PC name (2NDHANDBRUTUS) as the server and I can find AdventureWorks2012 :
However, I am not able to connect to it via R through the odbcConnect() statements. I have setup the following datasource:\
I have tried the following R command:
CON <- odbcConnect('AdventureWorks2012', uid = 'Rob Oudehand', pwd = 'Hondenmand5')
And I receive this error:
Warning messages:
1: In RODBC::odbcDriverConnect("DSN=AdventureWorks2012;UID=Rob Oudehand;PWD=Hondenmand5") :
[RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
2: In RODBC::odbcDriverConnect("DSN=AdventureWorks2012;UID=Rob Oudehand;PWD=Hondenmand5") :
ODBC connection failed
Can someone assist me in how I should access such a MDF-file from R? Should it be done via SQl Server via ODBSConnect, or is there another way?

Difficulty connecting to MS SQL Server from Postgresql on Windows (using DBI-Link)

Dear Stackoverflow Gurus,
I am having an issue connecting to MS SQL Server (2008) from PostgreSQL 9.3 on Windows. I am trying to connect through DBI-Link DBD::ODBC for Sql Server.
I would like your help on how to solve this issue, or maybe point out another way to Communicate to SQL Server from PostgreSQL on Windows.
The drivers seem to be working because when I add wrong credentials I get:
Severity: ERROR, Code: XX000, Line: 2117, Position: ErrorMessage: DBI
connect('Driver={SQL
Server};Server=10.XX.YY.ZZ\MyInstance','a_user',...) failed:
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'a_user'. (SQL-28000) at line 37. at line 35.
The Query I am using to create the connection (in Postgres) is:
UPDATE
pg_catalog.pg_settings
SET
setting =
CASE WHEN 'dbi_link' = ANY(string_to_array(setting, ','))
THEN setting
ELSE 'dbi_link,' || setting
END
WHERE
name = 'search_path'
;
SELECT make_accessor_functions(
'dbi:ODBC:Driver={SQL Server};Server=10.XX.YY.ZZ\MyInstance',
'a_user',
'Some_Password',
'---
AutoCommit: 1
RaiseError: 1
',
NULL,
NULL,
NULL,
'dbo'
);
The error I get (which also looks like it did connect) is:
Severity: ERROR, Code: XX000, Line: 2117, Position:
ErrorMessage: Could not connect to database
data source: dbi:ODBC:Driver={SQL Server};Server=10.XX.YY.ZZ\MyInstance
user: a_user
password: Some_Password
dbh attributes:
---
AutoCommit: 1
RaiseError: 1
[Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to 'master'. (SQL-01000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Changed language setting to us_english. (SQL-01000) at line 35.
My System:
OS: Windows 7 64-bit
PostgreSQL: 9.3
Perl: Strawberry Perl 5.14.3
Python: 3.4
Thanks

Resources