I want to convert the SQL script from SQL Server to MariaDB of the following below but I can't figure out.
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'client')
CREATE USER `client` FOR LOGIN `client` WITH DEFAULT_SCHEMA=`dbo`;'
ALTER ROLE `db_client` ADD MEMBER `client`
ALTER AUTHORIZATION
ON [ <class_type>:: ] entity_name
TO { principal_name | SCHEMA OWNER }
[;]
What is the best way to migrate SQL Server to MariaDB?
Or any equivalent of MariaDB?
Related
I created server with this code
CREATE SERVER `serv-prd4`
FOREIGN DATA WRAPPER mysql
OPTIONS (
USER 'connect',
PASSWORD '1234',
HOST '000.00.0.000',
PORT 3306,
DATABASE 'db-prd'
);
When I create table with engine = connect I get this error
CREATE TABLE sale
ENGINE=CONNECT
TABLE_TYPE=MYSQL
CONNECTION='serv-prd4';
SQL Error [1105] [HY000]: (conn=53) (1064) 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 '-prd' at line 1 [SHOW FULL COLUMNS FROM `sale` FROM db-prd]
I need to change a lot of code if I change the db name without dash...
Is there a way I can run this create query?
I linked an oracle db to my sql server.
I need to create a same table as linked server on my local db.
I'm trying to execute SELECT INTO query but I taking an error.
SELECT * INTO ABC_SYSUSERS FROM [OfficeOracle]..[PROJECTA].[SYSUSERS]
This is my error message.
The OLE DB provider "ORAOLEDB.Oracle" for linked server "OfficeOracle"
supplied inconsistent metadata for a column. The column "USERNAME"
(compile-time ordinal 1) of object ""PROJECTA"."SYSUSERS"" was
reported to have a "DBCOLUMNFLAGS_ISFIXEDLENGTH" of 16 at compile time
and 0 at run time.
Any solution ?
Actually, I could not fix the error which I mention above but I fixed my problem with using OPENQUERY;
SELECT * FROM OPENQUERY(LinkedServerName, 'SELECT * FROM DBName.Schema.Table')
I'm logged in as sysdba and I'd like to know which schema I'm using
If I create a table as sysdba how to see in which schema was created.
To return the current schema use:
SELECT SYS_CONTEXT('userenv', 'current_schema') FROM dual;
I would like to demonstrate SQL injection using Java and sqlite. I'm attempting to execute two queries at the same time with SQL injection. The user is to prematurely end the statement using ;, then add another entry using an insert statement.
Mysql JDBC using allowMultiQueries=true in the connection string.
How can I do this using sqllite?
TIA
allowMultiQueries as a MySQL-specific connection parameter.
I do not know of any SQLite JDBC driver that would allow multiple commands in one query.
Therefore, this kind of SQL injection attack is not possible.
Your best bet would be to construct some query like this:
SELECT * FROM Users WHERE Name = 'admin'--' AND Password = 'whatever'
or this:
SELECT *
FROM Users
WHERE Name = 'admin'
AND Password = 'whatever' or Name='admin'
I've stored password in mysql using SHA1 encryption And I have migrated my DB from mysql to DB2.
From Db2, how can I fetch record from Db2?
Select * from table where name = 'user' and password = sha1('123456')
But it generates error in db2. How can I check the login for the existing details?
If the original app contains only a few references to sha1() in the SQL statements, you could switch them a similar function in DB2, such as ENCRYPT() http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0004211.html.
Now you have a HASH function
SELECT HEX(HASH('Charlie at IBM',1)) FROM SYSIBM.SYSDUMMY1;
D6E42303462491FC696EAC53C1B086A5034735A7