Hibernate Postgresql SQLXML - postgresql

I use Spring boot with spring-jpa, database postgresql.
I'd like to call Stored Procedure via EntityManager.createStoredProcedureQuery.
One of stored procedure parameter is postgresql xml. If I transfer String as parameter I get an error. Could you explain me, please, how can I convert String to SQLXML in this situation?

Related

how to use parameterized Query in after sql in datastage?

I have to create a table in DB2 and read the query from file in Before/After Sql tab in Datastage.
I am using DB2 connector for this.
I have also parameterized the query but getting below error-
an unexpected token was found '/'.
create table Temp as(#Query#) with data
can u help in suggesting how can i achieve this successfully. Thanks in advance
Try loading the entire query into the parameter, rather than just the table name.

Migrating from SQL Server to Aurora PostgreSQL where encountering GUID, VARCHAR, UUID issues

I'm seeking some advice.
I've migrated a database from SQL Server to Aurora PostgreSQL using AWS DMS. In most of the tables in SQL Server, the primary keys are a uniqueidentifier (GUID). When migrated to Postgres these columns are converted to VARCHAR(36). This seems to be as expected, per the AWS DMS documentation.
In our .NET application, we use Entity Framework 6, which I have added a new dbContext to use the npgsql provider. Note that we are still keeping existing SQL Server EF6 providers. Essentially, the application will use both SQL Server and PostgreSQL. This is all hooked up fine.
Where I run into some issues is when my Postgres context is making fetches to the PostgreSQL database, it encounters a lot of errors
Npgsql.PostgresException: 42883: operator does not exist: character varying = uuid
I understand the issue, where the application using EF makes a fetch by Id (GUID), and the Postgres table has an Id that is VARCHAR type...
My feeling is the problem is not on the application or EF side, rather the column on the table should be something like a UUID. Which I can do, on post migration, I can simply alter the column to become a UUID type, but is this the way, and will it resolve my issues? I also feel like this can't be a unique case I'm dealing with; seems like a common issue for anyone also migrating a .NET app from SQL Server to PostgreSQL...
I look forward to hearing some of your ideas, comments, thoughts on this. Thanks in advance.
It seems that this migration procedure is not quite up to the task, as a GUID (which is Microsoft's confusing term for UUID) should be migrated to uuid. Not only would you save 21 bytes of storage space per row, but you also wouldn't have this problem.
It seems that your application is comparing a uuid value with one of the migrated varchars:
WHERE uniqueidentifier = UUID '87595807-3157-4a81-ac89-3e09e83c0c0a'
You have to add an explicit cast, like the error message says:
WHERE uniqueidentifier = CAST (UUID '87595807-3157-4a81-ac89-3e09e83c0c0a' AS text)
You would cast to text, not to varchar, because there is no equality operator for varchar. varchar is coerced to text when you compare it, because the storage for these types is identical.

Postgres Stored Procedure in Datastage

I am using Data Stage version 11.5. We recently migrated from Oracle to PostgreSQL. But now I am facing issues in how to call the PostgreSQL procedure in Datastage.
CALL executes a procedure.
If the procedure has any output parameters, then a result row will be returned, containing the values of those parameters.
See: https://www.postgresql.org/docs/current/sql-call.html

Native Function Return from Geography Data Type

I am creating a DDL file to be deployed as VDB using TEIID.
The source model is MS SQl. In the source database there is geography data type column. I am trying to read the lat and long from geography data type.
To retrieve the lat/long in sql server:
db.geogCol.Lat
db.geogCol.Long
When creating a view in ddl file using select statement and trying to retrieve the lat/long by passing to teiid, an exception is thrown. Teiid seems to think .Lat and .Long are columns whereas they are sql server function tied to the geography data column. How can i execute this so it treats the above arguments as ms-sql
The closest representation is a source function. You will need to create source functions to represent them. On the sql server schema:
create foreign function lat (geography geog) returns double
OPTIONS ("teiid_rel:native-query" '$1.Lat');
and a similar one for Long.
Teiid does have the st_x and st_y functions, but I don't think they are eligible for pushdown to sql server currently.

DB2 query for fetching clob value

In DB2 , how do we write a query to fetch value from clob datatype column
Not sure if this will help with your situation, but we ran into a similar situation at my company. For us, we were able to read the values out as a normal string using C#/.NET and the IBM iSeries data provider. The data we wanted to fetch from the CLOB was just simple text, which allowed this process to work.
For sql/pl, you can select clob data from database same other type, but if you use jdbc I should byte[] for Clob data.