Skip to content
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

Not working with recent versions #14

Closed
jacky-lam opened this issue Jun 1, 2020 · 10 comments
Closed

Not working with recent versions #14

jacky-lam opened this issue Jun 1, 2020 · 10 comments

Comments

@jacky-lam
Copy link

Hi,

I have tried to use your library for java 11, and experiencing some problems.

My code:

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String dbURL = "jdbc:sqlserver://localhost:1433;databaseName=test";
Properties properties = new Properties();
properties.put("user", "sa");
properties.put("password", "test");
Connection conn = DriverManager.getConnection(dbURL, properties);
SqlServerBulkInsert<MyObject> bulkInsert = new SqlServerBulkInsert<>(mappingObject);
bulkInsert.saveAll(conn, objects.stream());

My JDBC in pom.xml

        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>8.2.2.jre8</version>
        </dependency>

Error at runtime:

Exception in thread "main" java.lang.NoSuchMethodError: 'void com.microsoft.sqlserver.jdbc.SQLServerBulkCopy.writeToServer(com.microsoft.sqlserver.jdbc.ISQLServerBulkRecord)'
	at de.bytefish.jsqlserverbulkinsert.SqlServerBulkInsert.saveAll(SqlServerBulkInsert.java:40)
	at de.bytefish.jsqlserverbulkinsert.SqlServerBulkInsert.saveAll(SqlServerBulkInsert.java:27)
  • Seems like there is an issue with the recent version?
@jacky-lam jacky-lam changed the title Not working Not working with recent versions Jun 1, 2020
@bytefish
Copy link
Collaborator

bytefish commented Jun 1, 2020

This is for project JSqlServerBulkInsert I assume? I am transferring the issue to JSqlServerBulkInsert.

@bytefish bytefish transferred this issue from bytefish/SqlServerBulkInsert Jun 1, 2020
bytefish added a commit that referenced this issue Jun 1, 2020
@bytefish
Copy link
Collaborator

bytefish commented Jun 1, 2020

I have removed the deprecated ISqlServerBulkRecord and now implement the ISqlServerBulkData directly. The call to writeToServer in SQL Server JDBC driver version 8.2.2.jre8 now works correctly.

The Version 3.0.0 of the Library has been released to the Maven Central Repositories and should be available within some hours, it always takes some time for the Maven Repositories to sync.

@bytefish bytefish closed this as completed Jun 1, 2020
@bytefish bytefish reopened this Jun 1, 2020
@bytefish
Copy link
Collaborator

bytefish commented Jun 1, 2020

@jacky-lam Please let me know, if the issue is fixed once the new version is availbale in Maven. 👍

@bytefish
Copy link
Collaborator

bytefish commented Jun 1, 2020

@vslee I haven't had time to look into the Release Drafter Plugin to draft this Release. I am sorry, maybe you could add it to the repository?

@vslee
Copy link
Member

vslee commented Jun 1, 2020

I'll take care of the release notes.

@vslee
Copy link
Member

vslee commented Jun 1, 2020

The way Release Drafter works is that it will create a list of the pull requests that are merged. It categorizes them based on the label (bug, enhancement, maintenance). It doesn't list changes that are committed directly w/o a PR though. So if you make any big changes in the future that you'd like to automatically include in the changelogs, make them through a PR instead of committing directly. You can apply a label and then still immediately approve/merge the PR afterwards.
(Since there are not that many updates to this project, I also don't mind creating the release changelogs manually from the commits.)

@bytefish
Copy link
Collaborator

bytefish commented Jun 1, 2020

@vslee Thanks, it's noted. Next time I will do a clean PR!

@jacky-lam
Copy link
Author

jacky-lam commented Jun 2, 2020

Hi @bytefish

Thank you for making a quick fix. I have tested and this is working!

Not necessary, but it might be helpful to include in the README that you must map all the fields in the table, otherwise it won't work (i.e. I omitted the auto-generated fields (e.g. fields populated by triggers/auto-increments) and it didnt work 😛)

@bytefish
Copy link
Collaborator

@jacky-lam Maybe you could create a separate ticket and describe what's missing in the README. 👍

@jacky-lam
Copy link
Author

#15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants