Unable to create Databases in Azure SQL Managed SQL - azure-managed-database

When running the create DB from the managed instance I get this message.
{
"status": "Failed",
"error": {
"code": "LinkedInvalidPropertyId",
"message": "Property id '' at path 'properties.recoverableDatabaseId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'."
}
}
I tried creating the database from SMSS and got the same type of error messages.

Related

JDBC Sink Connector - how to specify a database schema in SQL Server?

I am using a JDBC Sink Connector to insert data into SQL Server. My table is called Plant and the schema is pts. So I'm trying to insert into InventoryManagement.pts.Plant.
I've set up a new user called testuserpts in SQL Server, with the default schema name set to pts. The error message that I'm getting back from Confluent is that Table "dbo"."Plant" is missing and auto-creation is disabled.
Here's my configuration for the sink connector. How do I prevent the sink from trying to connect to dbo.Plant?
"value.converter.schema.registry.url": "http://schema-registry:8081",
"value.converter.schemas.enable": "true",
"name": "JdbcSinkConnector",
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "io.confluent.connect.avro.AvroConverter",
"topics": ["plant"],
"connection.url": "jdbc:sqlserver://host.docker.internal:53954;instance=SQLEXPRESS;databaseName=InventoryManagement",
"connection.user": "testuserpts",
"connection.password": "testpassword",
"table.name.format": "Plant"
I finally managed to get it working. The correct config is:
"table.name.format": "InventoryManagement.pts.Plant"
So, <db>.<schema>.<table

PostgresException: 3D000: database "kap_dev" does not exist

I am using serenity with postgres and I have generated a new project using visual studio 2019.
I have followed the tutorial of how to make the app connect with Postgresql.
I have created a new database and user in PgAdmin.
I have enabled the app to run migrations when I run my app.
Here is a sample of my connection string.
"Data": {
"Default": {
"ConnectionString": "Server=localhost; Port=5432; User Id=kap_dev; Database=kap_db; Password=kapap_password;",
"ProviderName": "Npgsql"
}
However, I get the error
PostgresException: 3D000: database "kap_dev" does not exist.
The issue is that kap_dev is a user and not a database.
I even posted this error to their git-issues but serenity have not responded with a valid answer.
might be a typo, no space between User and Id
You have to create a database which name is the name of your user "kap_dev".

How to import MS Sql Server tables to KSQL with Kafka connect

Hi I am trying to import all tables present on remote SQL Server to KSQL topics
this is my file properties
connector.class=io.confluent.connect.cdc.mssql.MsSqlSourceConnector
name=sqlservertest
tasks.max=1
initial.database=$$DATABASE
connection.url=jdbc:sqlserver://$$IP:1433;databaseName=$$DATABASE;user=$$USER;
username=$$USER
password=$$PASS
server.name=$$IP
server.port=1433
topic.prefix=sqlservertest
key.converter=io.confluent.connect.avro.AvroConverter
key.converter.schema.registry.url=http://localhost:8081
value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schema.registry.url=http://localhost:8081
mode=bulk
auto.create=true
auto.evolve=true
than i do
confluent load sqlservertest -d /opt/kakfkaconf/sqlservertest.properties
and in the log
confluent log connect -f
it shows
[2018-10-10 14:18:43,856] INFO Finished starting connectors and tasks (org.apache.kafka.connect.runtime.distributed.DistributedHerder:868)
it run correctly but it doesn't import anything, the topic remain empty
confluent status sqlservertest
{
"name": "sqlservertest",
"connector": {
"state": "RUNNING",
"worker_id": "10.132.0.2:8083"
},
"tasks": [],
"type": "source"
}
I have chenaged also the properties
name=mssql
connector.class=io.confluent.connect.cdc.mssql.MsSqlSourceConnector
tasks.max=2
initial.database=$$DB
username=$$USER
password=$$PASS
server.name=$$IP
server.port=1433
change.tracking.tables=$$SCHEMA.$$TABLE
auto.create=true
auto.evolve=true
topic.prefix=$$DB
key.converter=io.confluent.connect.avro.AvroConverter
key.converter.schema.registry.url=http://localhost:8081
value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schema.registry.url=http://localhost:8081
but i am getting this error
[2018-10-10 15:06:09,216] ERROR Exception thrown while querying for ChangeKey{databaseName=$$DB, schemaName=$$SCHEMA, tableName=$$TABLE} (io.confluent.connect.cdc.mssql.QueryService:94)
org.apache.kafka.connect.errors.DataException: Exception thrown while getting metadata for ChangeKey{databaseName=$$DB, schemaName=$$SCHEMA, tableName=$$TABLE}
at io.confluent.connect.cdc.CachingTableMetadataProvider.tableMetadata(CachingTableMetadataProvider.java:64)
at io.confluent.connect.cdc.mssql.QueryService.queryTable(QueryService.java:108)
at io.confluent.connect.cdc.mssql.QueryService.processTables(QueryService.java:92)
at io.confluent.connect.cdc.mssql.QueryService.run(QueryService.java:67)
at com.google.common.util.concurrent.AbstractExecutionThreadService$1$2.run(AbstractExecutionThreadService.java:60)
at com.google.common.util.concurrent.Callables$3.run(Callables.java:95)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '='.
at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
... 6 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '='.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:259)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1547)
... 11 more
I found the real cause of this error, Kafka connector are using the functions that is present just in MS Sql server 2012, in particular IFF and boolan comparison in function
select IFF(1>2,'OK','KO');
select (1>2) as bool;
that are NOT working on MS Sql 2008
The real cause is that Conflunet MSSQL Connector is made just for MS SQL Server 2012 and above and I am runnning version 2008
I decompiled the library kafka-connect-cdc-mssql and adjusted the sql code to be compliant with sqlserver 2008 and now it's working.
Maybe I will push it to github to make it available for everybody

Visual Studio Code mssql extension won't connect to the server

Ok, so the problem is VSCode won't connect to the server, mssql extension is installed.
I have used localhost as the server name, tried with Integrated login, wouldn't connect. Tried with SQL Login, with User Name SA and sa, and passwords "", "sql", "SQL". Used all combinations.
Does anybody have any idea what's going on? Is there something I have to set up before I start connecting to the server?
If, for example, you are using LocalDb,
add this to your User settings.json file in VsCode:
"mssql.connections": [
{
"server": "(localdb)\\mssqllocaldb",
"database": "YourDatabaseName",
"authenticationType": "Integrated",
"profileName": "YourProfileName",
"password": ""
}
]
"YourProfileName" is anything you want. It shows up in Object Explorer.
I use the mssql extension with VSCode on a Macbook, and this is how I got it to work...
As John Pankowicz mentioned, you can add your connections directly into the settings.json file which lives in your .vscode folder (user profile or workspace level).
On my Mac, I must specify the protocol to use for connecting to the SQL Server on our domain, which in my case, is tcp.
Also, you may specify a profileName for each of your database connections if your server names are very cryptic and difficult to remember.
So an entry in my settings.json looks like this:
"mssql.connections": [
{
"profileName": "FOOBARDEV",
"authenticationType": "Integrated",
"trustServerCertificate": true,
"server": "tcp:foosql28.foobar.com\\edsql281,581"
}]
Once defined, the connection appears in the VsCode sidebar within the CONNECTIONS section of the SQL Server extension listed by profile name.
Alternatively, you can define an ADO.NET connection string:
"mssql.connections": [
{
"profileName": "FOOBARDEV",
"connectionString": "data source=tcp:foosql28.foobar.com\\edsql281,581;Integrated Security=True;initial catalog=Foo; Trust Server Certificate=True"
}]

How to migrate SQLite database to an encrypted SQLite database? (Titanium)

I have an existing app built with appcelerator's titanium. It currently has a database existing on it, but I want to upgrade it to an encrypted database. I am using appcelerator's encrypted database module. If I delete the local database and build the app clean it is fine, the problem is when I try to migrate from the existing database to the encrypted one. I get this error:
file is encrypted or is not a database
message = "Couldn't open database and migrate";
Script Error Module "alloy/models/table.js" failed to leave a valid exports object
My exports definition looks like this:
'config': {
columns: columns,
defaults: {},
adapter: {
"type": "enc.db",
"collection_name": "table",
"idAttribute": "LocalID",
"db_name": "_alloy_.enc.db"
}
},

Resources