Error using Sybase IQ proxy table - sql

I have a use case that requires me to make a join on a table t1 from Sybase ASE and table t2 from Sybase IQ . I am trying to achieve this by creating a proxy_table on Sybase IQ as follows:
create server SYB1 class 'ASAODBC' using
Driver=libsyb64.so;Server=hostname;Port=portnum;PacketSize=16384;
EnableServerPacketSize=0'
(I even tried above with 'ASEODBC' and 'ODBC' classes)
create external login XYZ to SYB1 remote login 'SYBASEASEusername'
identified by SYBASEASEpwd'
create existing table 'proxy_table_name' at 'SYB1.dbname.owner.tablename'
On firing above sqls I get:
[Sybase][ODBC Driver][Sybase IQ] Unable to connect to 'SYB1': [Sybase][ODBC Driver]
[SQL Anywhere] Unable to connect ; server definition is circular
I have entry for the above mentioned Sybase ASE host in interfaces file and I tried to create the server by specifying the server name itself but it failed nevertheless.
Any help appreciated.

That error occurs when you attempt to connect to a remote server that maps to the local database. That's not possible in Sybase IQ. Check if the ODBC is pointing to the correct server (in your case should be the ASE server).

Your proxy server is using class 'ASAODBC' but since you're connecting to an ASE server, it should be 'ASEODBC'. As aF. said, you also need to make sure your connection string is pointing at the ASE server, not the IQ server.
Full disclosure: I work for SAP in SAP SQL Anywhere engineering. SQL Anywhere is the execution engine for SAP IQ (formerly Sybase IQ).

Related

SCADA reading from MariaDB: Error in Syntax

We have a SCADA System (Intouch). It had a Access .mdb database file on the client PC, which was defined as System DSN (Windows ODBC).
What I'm trying to do is to migrate the whole DB thing to MariaDB, running on remote server. I have already a running server, the connection from the SCADA PC to the server is up an running and it is added as system DSN in ODBC, using the MariaDB ODBC connector. I was also able to export all the data from Access to the Maria database, using Access's native export to ODBC database, so all my data is in Maria.
The Problem: The SCADA cannot read ot white anythig. In the scada's log i get SQL Syntax errors (forgot to mention, that the scada uses SQL). Thanks in advance!
Update:
It's old fashioned WindowMaker application, not Archestra, thus the SQL Functions are used. I've even changed the ODBC connector from Maria to mySQL
Today I've made some logs. Here the error:
"SELECT Checksum, (rest deletet by me.. is too long).... FROM Stp WHERE ProgNr=1and StpNr=0"
[37000] [MySQL][ODBC 8.0(a) Driver][mysqld-5.5.5-10.3.22-MariaDB]
You have an error in your SQL syntax; check the manual that corresponds
to your MariaDB server version for the right syntax to use near 'StpNr=0' at line 1 (1064)
From the review of your update it looks like its just a plain ol' syntax error.
What you provided:
SELECT Checksum, (etc)... FROM Stp WHERE ProgNr=1and StpNr=0
The logs complain of syntax by StpNr=0 but your problem is immediately before that where you haven't put a space between the AND and the ProgNr=1 command.
Correct syntax would be:
SELECT Checksum, (etc)... FROM Stp WHERE ProgNr=1 and StpNr=0
In my personal experience the WindowMaker SQL functions are extremely clunky to work with (especially with the 131 char limit on message tags). You can usually help yourself out by Logging your Query then trying it directly in your database.

How to set up SSIS to extract data from Postgres Database

I have a database PostGres database in the AWS Cloud. I would like to use SSIS to extract tables and move them over to a local SQL Server.
Has anyone attempted to do this? Is it possible?
Ultimately I would like to move over tables from the PostGres to a SQL server, without having to purchase a tool.
As per the documentation, you would need to follow these steps to connect SSIS to a Postgres database:
get the PostgreSQL ODBC driver, either with Stack Builder or using ODBC
connect to PostgreSQL with the PostgreSQL ODBC driver (psqlODBC), using the proper connection string, typically Driver={PostgreSQL ODBC Driver(UNICODE)};Server=<server>;Port=<port>;Database=<database>;UID=<user id>;PWD=<password>
You can use the Postgres OLE DB Provider to connect to Postgres using OLE DB Source. The following link contains a step by step guide to import data from Postgres into SQL Server:
Export data from Postgres to SQL Server using SSIS

how to Create ODBC Connection from Access to SQL Server using link server?

I am create odbc for access db
Odbc access database file like this:
when i try to create link server in sql ,unable to connect.IS IT POSSIBLE TO CONNECT THROUGH link server
Link server-see here
When i use below query it created successfully and tested,but i can't use access db and sql at same time.
Error :File in use
exec sp_addlinkedserver #server='TIMES',
#srvproduct='TIMES',
#provider='Microsoft.Jet.OLEDB.4.0',
#datasrc=N'C:\Program Files\xxxx\aaa.mdb'
exec sp_addlinkedsrvlogin #rmtsrvname='TIMES',
#useself='false',
#rmtuser='Admin',
#rmtpassword=''
could any help to rectify this?
Something like this should get you pointed in the right direction.
#1) ODBC Database (create link to SQL Server)
#2) Open the link and view your Information_Schema (or whatever you want) in SQL Server.

SQL Server : Linked Server row physical location

I can query the physical location of a row in Microsoft SQL Server by %%physloc%% identifier. For example like this
select %%physloc%% from [testdb].[dbo].[table1_t4];
I have created a linked server of this SQL Server instance with dbserv instance. I can query the row of this instance like:
select * from [dbserv].[testdb].[dbo].[table1_t4];
But when I query the physical location of the rows
select %%physloc%% from [dbserv].[testdb].[dbo].[table1_t4];
This throws the error:
Invalid column name '%%'.
How do I workaround by obtaining the physical location of the row of the linked server for my application?
Linked servers are all connected through OLE DB Providers like ODBC. While the "Virtual Column %%phys_loc%%" is an undocumented feature in SQL Server 2008. As such, OLE DB providers (barring the SQL Server native driver) aren't likely to support it, but I can't seem to find the documentation for it specifically.
Testing it out here, it also looks like it will only work when connected to the server locally, otherwise I get the same error you post here. Quoting the identifier throws an invalid column name error.
I don't believe you will be able to query this identifier through linked server at all.

SQL statement joining Oracle and MS SQL Server

I never seen this, but is it possible to have one SQL call join data from Oracle and SQl Server?
Yes, Oracle and SQL Server both have functionality that allows to connect to other databases, including different vendors. In Oracle terminology, it's a database link instance while on SQL Server it's called a Linked Server instance.
The syntax to reference the instance is different between Oracle and SQL Server though. IE:
Oracle:
SELECT t.*
FROM table_name#database_link_instance t
SQL Server:
SELECT t.*
FROM linked_server_instance_name.database_name.schema_name.table_name t
does MySQL support the linked server concept?
No, the closest MySQL has is the FEDERATED engine, which is only for connecting to remote MySQL instances.
PostgreSQL?
PostgreSQL has dblink. Last time I looked at dblink (pre-v9 release), it only could connect to other PostgreSQL instances.
Yes- both Oracle and SQL Server support the linked server concept. That allows you to reference the other server using a 4 part name. For example:
select *
from LocalDb.Schema.Table
cross join
OracleLinkedServer.RemoteDb.RemoteSchema.RemoteTable