-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] SQLServerBulk Copy: Unable to retrieve column metadata. #2483
Comments
hi @orgesballa We are not aware of any issues with bulkcopy we have tests for bulkcopy here please take a look see what you are doing differently? If you are still having issues, please provide a schema and a standalone java repro for the issue so we can take a look. |
Hi @orgesballa, Are you still having issues with bulkcopy? If so, please provide a repro as mentioned above, if not, we will move forward with closing this issue. |
@Jeffery-Wasty In this example, I tried to use the same way as in my real project. I used liquibase, kept the table the same with one FK and 5 INT columns. The same error happened again, unable to retrieve column metadata. If I remove the |
hi @orgesballa Thanks for the repro we will take a look and get back to you. |
Just an update @orgesballa. We have gotten the provided repro working and are trying to understand the reported issue. |
Hi, thanks for the update. |
The Spring framework is abstracting the problem making it difficult to determine exactly what is the issue. Is there any way you could replicate the issue calling the driver directly? |
@barryw-mssql Sorry, haven't had the time. will try to provide an example today |
@barryw-mssql I think I found the root cause. Removing the liquibase and using directly the tables created, also makes it work for the original example. So the issue is the way liquibase creates the tables combined with SqlServerBulkCopy introduces this error. |
Interesting observation orgesballa. As the tables are created via SQL using the same MSSQL driver, ideally there should be no difference between how liquibase and manual SQL creates a table. Your observation that removing liquibase as the table creator indicates that it is doing something different. If you want to explore the differences between liquibase and manual table creation further, I suggest that you enable the JDBC driver logging (https://learn.microsoft.com/en-us/sql/connect/jdbc/tracing-driver-operation?view=sql-server-ver16) and inspect the SQL generated by liquibase. Since you now have things working we will be closing this issue. Please feel free to reopen the issue if further assistance is required. Thx, |
I encountered the same problem when using executeBatch(). In my case, the reason is that the column names are case-sensitive. Refer to my issue #2588, PR #2589 . It is possible that there are differences in capitalization between the table created by liquibase and the one you created manually. |
Question
I am trying to benefit from SQLServerBulkCopy to insert millions of rows in the database efficiently.
I am using Spring Boot + Spring JDBC to write the queries.
Driver version: 12.8.0.jre11
The issue happens on two tables that I have. One uses Identity column and one sets the ID explicitly.
Before this I see the query being executed:
In fact the result of this is: all values NULL and is_computed false.
The columns in this table are:
ID bigint
DataFileID bigint
All others int.
I am not sure what is wrong since all limitations mentioned in the documentation are not happening.
Can someone guide me how to fix this?
The text was updated successfully, but these errors were encountered: