NOT LIKE on connect table on mariadb - sql

I have an issue on an sql statement with the mariadb-connect-engine.
Actually it's the NOT LIKE operator which return really strange result.
On this sql request :
SELECT ARS_RESSOURCE, ARS_LIBRERES1 FROM ressource WHERE ARS_RESSOURCE NOT LIKE '568614561456%'
it would return all the result in the datatable, but it just don't return anythink while :
SELECT ARS_RESSOURCE, ARS_LIBRERES1 FROM ressource WHERE ARS_RESSOURCE LIKE '%'
or :
SELECT ARS_RESSOURCE, ARS_LIBRERES1 FROM ressource WHERE ARS_RESSOURCE LIKE '01%'
return all the result asked.
Did i do something wrong or the NOT LIKE operator on a connect table have a diferrent behaviour than on classic connector ?
To be more accurate i use a connect table from mariadb to sqlserver, so maybe this behaviour could be cause by the ODBC driver or something but i don't find any clue at the moment

Actually I opened an issue on the support site of MariaDB and the NOT LIKE operator isn't works properly at the moment with the CONNECT engine when you use it with the CONNECTION argument to connect on an other table.
Here is the link of the opened issue on mariaDB.org:
link to jira.mariadb.org
maybe this could help some people with the same issue.
(to be more accurate this was opened on 10.2.* version of MariaDB and not solve at this date)

Related

SQL Server FullTextSearch doesn't work properly for German

We have two SQL Servers and on both of them FTS is enabled and should be configured the same way. Both run with the same server version. The SQL Server we have problems with runs in Azure.
I also have checked the wordbreaker language versions with the following statement. Both have the version 14.0.4763.1000 installed for German (1031).
EXEC sp_help_fulltext_system_components 'wordbreaker'
On one server, we do not get results properly, even though the word we are searching for exists in the table. With the following query we don't get any results:
SELECT *
FROM vsTst vsTst
WHERE CONTAINS(vsTst.Content, 'FORMSOF(INFLECTIONAL, Einzelunternehmen) OR "Einzelunternehmen*"', LANGUAGE 1031)
But with the keyword "Einzelunternehm" instead of "Einzelunternehmen" we get the results we are looking for:
SELECT *
FROM vsTst vsTst
WHERE CONTAINS(vsTst.Content, 'FORMSOF(INFLECTIONAL, Einzelunternehmen) OR "Einzelunternehm*"', LANGUAGE 1031)
We have absolutely no clue what the issue is. Does anybody have the same problem or have any idea what we have done wrong?
Thx

SELECT without a TABLE (JDBC)

In most sql databases I have seen you can do something like:
SELECT ABS(-2.4)
and I get back 2.4. Notice there is no FROM clause.
When I try to do this in OpenEdge via Squirrel and the JDBC driver I get a syntax error. Is there a way to run SELECT statements like this (sans FROM clause) via JDBC?
Single row/column Dual equivalent; SYSPROGRESS.SYSCALCTABLE

FM ExecuteSQL returns different results than direct database query

I am wondering if anyone can explain why I get different results for the same query string between using the ExecuteSQL function in FM versus querying the database through a database browser (I'm using DBVisualizer).
Specifically, if I run
SELECT COUNT(DISTINCT IMV_ItemID) FROM IMV
in DBVis, I get 2802. In FileMaker, if I evaluate the expression
ExecuteSQL ( "SELECT COUNT(DISTINCT IMV_ItemID) FROM IMV"; ""; "")
then I get 2898. This makes me distrust the ExecuteSQL function. Inside of FM, the IMV table is an ODBC shadow, connected to the central MSSQL database. In DBVis, the application connects via JDBC. However, I don't think that should make any difference.
Any ideas why I get a different count for each method?
Actually, it turns out that when FM executes the SQL, it factors in whitespace, whereas DBVisualizer (not sure about other database browser apps, but I would assume it's the same) do not. Also, since the TRIM() function isn't supported by MSSQL (from what I've seen, at least) it is necessary to make the query inside of the ExecuteSQL statement something like:
SELECT COUNT(DISTINCT(LTRIM(RTRIM(IMV_ItemID)))) FROM IMV
Weird, but it works!
FM keeps a cache of the shadow table's records (for internal field-id-mapping). I'm not sure if the ExecuteSQL() function causes a re-creation of the cache. In other words: maybe the ESS shadow table is out of sync. Try to delete the cache by closing and restarting the FM client or perform a native find first.
You can also try a re-connect to the database server via the Open File script step.
HTH

How to Query Database Name in Oracle SQL Developer?

How do I query the database name in Oracle SQL Developer? I have tried the following and they all fail:
SELECT DB_NAME();
SELECT DATABASE();
Why do these basic MySQL queries fail in SQL Developer? Even this one fails too:
show tables;
EDIT: I can connect to the database and run queries such as:
select * from table_name_here;
EDIT 2: The database type is Oracle, this is why MySQL queries are failing. I thought it was related to the database client not the database itself. I was wrong. I'll leave the question as is for other as lost as I was.
Once I realized I was running an Oracle database, not MySQL, I found the answer
select * from v$database;
or
select ora_database_name from dual;
Try both. Credit and source goes to: http://www.perlmonks.org/?node_id=520376.
try this:
select * from global_name;
You can use the following command to know just the name of the database without the extra columns shown.
select name from v$database;
If you need any other information about the db then first know which are the columns names available using
describe v$database;
and select the columns that you want to see;
I know this is an old thread but you can also get some useful info from the V$INSTANCE view as well. the V$DATABASE displays info from the control file, the V$INSTANCE view displays state of the current instance.
Edit: Whoops, didn't check your question tags before answering.
Check that you can actually connect to DB (have the driver placed? tested the conn when creating it?).
If so, try runnung those queries with F5
To see database name,
startup;
then type
show parameter db_name;
DESCRIBE DATABASE NAME; you need to specify the name of the database and the results will include the data type of each attribute.

Expression Builder to SQL Query

I know, that similiar post was posted already (SQL query from Toplink expression), but I didnt find an answer there. I would like to get SQL query from Expression Builder expression:
I have
Expression exp = builder.get(NUMBER.getAttributeName()).equal(getNumber());
and I want to see the SELECT statement, like (Select * from table WHERE number=....)
Or is it possible to execute the expression from Expression Builder without session? (I know that when I used query.prepareCall(session, new DatabaseRow()) I can obtain statement, but I just need to avoid using session. Thank you very much.
You must have the Session (what are you going to execute it on without a Session???).
query.prepareCall(session, new DatabaseRow())
This is how you get the SQL, you need to create a ReadAllQuery with the expression to be able to get the SQL (an Expression is just a where clause).
The problem was, that i wasnt able to create session because I couldnt register my project. And that was because I miss one line of code in my Project.class
setName(APPLICATION_NAME);
After this, I was able to create session and execute query. Thank you anyway