Thursday, February 23, 2023

SET QUOTED_IDENTIFIER Değişkeni

Giriş
SET QUOTED_IDENTIFIER OFF ile Tablo ve Sütun isimleri etrafında double quote kullanılamaz

Örnek - Off
Şöyle yaparız
SET QUOTED_IDENTIFIER OFF
GO

-- Create statement fails.
CREATE TABLE "select" ("identity" INT IDENTITY NOT NULL, "order" INT NOT NULL);
GO
Örnek - ON
Şöyle yaparız
SET QUOTED_IDENTIFIER ON;
GO

-- Create statement succeeds.
CREATE TABLE "select" ("identity" INT IDENTITY NOT NULL, "order" INT NOT NULL);
GO

SELECT "identity","order"
FROM "select"
ORDER BY "order";
GO

DROP TABLE "SELECT";
GO

SET QUOTED_IDENTIFIER OFF;
GO

Sütun Tipleri - NVARCHAR - UNICODE Karakterler İçindir

Giriş
VARCHAR ile aynıdır. İsminde N olduğu için UNICODE karakterler içindir

Örnek
Şöyle yaparız
CREATE TABLE book (
    id BIGINT NOT NULL PRIMARY KEY,
    isbn VARCHAR(15),
    properties NVARCHAR(4000) CHECK(
        ISJSON(properties) = 1
    )
)
Açıklaması şöyle
Notice that the properties column type is NVARCHAR(4000), and we defined a column-level constraint check which uses the ISJSON SQL Server function to validate whether the properties column is storing a proper JSON object.

JDBC Sürücüleri

Örnek
Şöyle yaparız
<dependency>
<groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> <version>12.2.0.jre8</version> </dependency>
Örnek
Şöyle yaparız
<dependency>
<groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> <version>12.4.0.jre8-preview</version> </dependency>

Tuesday, February 21, 2023

Debezium Connector

Örnek
Şöyle yaparız
debezium.sink.type=pubsub
debezium.sink.pubsub.project.id= <<PUT YOUR PROJECT_ID>>
debezium.source.connector.class=io.debezium.connector.sqlserver.SqlServerConnector
debezium.source.offset.storage.file.filename=/tmp/offsets.dat
debezium.source.offset.flush.interval.ms=0
debezium.source.database.hostname=<<SQL-Server HOSTNAME/IP_ADDRESS>>
debezium.source.database.port=1433
debezium.source.database.user=sa
debezium.source.database.password= <<PASSWORD>>
debezium.source.database.dbname=demodb
debezium.source.database.server.name=demodb
debezium.sink.pravega.scope=empty
debezium.source.table.whitelist=dbo.Inventory
debezium.source.database.history.file.filename=/tmp/FileDatabaseHistory.dat
debezium.source.database.history=io.debezium.relational.history.FileDatabaseHistory



Debezium Kullanımı İçin Hazırlık

Örnek
Şöyle yaparız
# Enable CDC for database “demodb”
USE demodb
GO
EXEC sys.sp_cdc_enable_table 

# Enable the data capture on the source table
@source_schema = N'dbo', 
@source_name   = N'Inventory',  
@role_name     = NULL,   
@supports_net_changes = 0
GO


Sütun Tipleri - VARCHAR - UNICODE Karakterler İçindir

Giriş UNICODE olmayan normal karakterler İçindir Örnek Şöyle yaparız CREATE TABLE ExampleTable (     ExampleColumn VARCHAR(255) ); INSERT IN...