SEPURI-SAI-KRISHNA opened a new issue, #13075:
URL: https://github.com/apache/seatunnel/issues/13075

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   ### What happened
   
   Two case conversions in the SQL Server JDBC code use the JVM default locale. 
Under `tr-TR` and `az-AZ`, `"i".toUpperCase()` is `"İ"` (U+0130), so both break 
on a worker with such a default locale.
   
   **Column types.** `SqlServerTypeConverter.convert` upper cases the type name 
before its `switch` (`SqlServerTypeConverter.java:112`):
   
   ```java
   String sqlServerType = typeDefine.getDataType().toUpperCase();
   ```
   
   SQL Server type names are lower case: the catalog reads `sys.types.name`, 
the query path reads `ResultSetMetaData.getColumnTypeName`, and the Microsoft 
JDBC driver reports names such as `int`, `bigint`, `datetime2` and `decimal` 
(its `SSType` names, checked in mssql-jdbc 9.2.1). So `int` becomes `İNT` and 
the column fails to convert. Every type name with an `i` is affected: `int`, 
`bigint`, `tinyint`, `smallint`, `bit`, `decimal`, `numeric`, `datetime`, 
`datetime2`, `smalldatetime`, `time`, `binary`, `varbinary`, `image`, 
`uniqueidentifier`. This one method serves the catalog (`table_path`), the 
query path and SQL Server CDC (`SqlServerTypeUtils`). In a JVM started with 
`-Duser.language=tr -Duser.country=TR`, 13 tests in 
`SqlServerTypeConverterTest` fail on `dev`.
   
   **`instanceName` in the URL.** `SqlServerURLParser.parse` upper cases the 
URL property keys to match them case insensitively 
(`SqlServerURLParser.java:52`), then looks up `"INSTANCENAME"`. Under `tr-TR` 
the key becomes `İNSTANCENAME`, the instance is not found, and the parser falls 
back to port 1433. Measured with the class from `dev`, for 
`jdbc:sqlserver://localhost;instanceName=SQLEXPRESS;databaseName=myDB;encrypt=false`:
   
   ```
   ROOT   
jdbc:sqlserver://localhost\SQLEXPRESS;instanceName=SQLEXPRESS;encrypt=false   
port=null
   tr-TR  jdbc:sqlserver://localhost:1433;instanceName=SQLEXPRESS;encrypt=false 
       port=1433
   ```
   
   The driver documentation says that when both a port and an instance name are 
given, the port takes precedence and the instance name is ignored. So the 
catalog and SQL Server CDC connect to the default instance instead of the named 
one.
   
   ### SeaTunnel Version
   
   dev (f3e1c2ee3b)
   
   ### SeaTunnel Config
   
   ```conf
   source {
     Jdbc {
       url = 
"jdbc:sqlserver://localhost;instanceName=SQLEXPRESS;databaseName=test;encrypt=false"
       driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
       user = "sa"
       password = "..."
       table_path = "test.dbo.orders"
     }
   }
   ```
   
   ### Running Command
   
   ```shell
   Any SQL Server job on a worker started with -Duser.language=tr 
-Duser.country=TR
   ```
   
   ### Error Exception
   
   ```log
   ErrorCode:[COMMON-17], ErrorDescription:['SqlServer' unsupported convert 
type 'İNT' of 'test' to SeaTunnel data type.]
   ```
   
   ### Zeta or Flink or Spark Version
   
   All engines. The code is in `connector-jdbc`.
   
   ### Java or Scala Version
   
   Reproduced on JDK 17.
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to