0

I am trying to change from Sql server to Postgres db, and I am storing data to db using SQLServerBulkCopy in sql server, for importing csv files . Is there any similar way of copying data to db, in postgres. Here is my source code for doing that in sql server:

 SQLServerBulkCSVFileRecord fileRecord = null;

        fileRecord = new SQLServerBulkCSVFileRecord(crawler.folderPath + "\\" + crawler.srcPasiv() + ".csv", true);
       // fileRecord.addColumnMetadata(1, null, java.sql.Types.NULL, 250, 0);
        fileRecord.addColumnMetadata(1, null, java.sql.Types.VARCHAR, 250, 0);
        fileRecord.addColumnMetadata(2, null, java.sql.Types.VARCHAR, 250, 0);
        fileRecord.addColumnMetadata(3, null, java.sql.Types.VARCHAR, 250, 0);
        fileRecord.addColumnMetadata(4, null, java.sql.Types.VARCHAR, 250, 0);
4
  • If this is a one time thing, just use the COPY SQL command. SQL COPY Command. Commented Nov 12, 2018 at 14:44
  • I should have mentioned it, it is not a one time thing,thanks Commented Nov 12, 2018 at 14:48
  • Why are you migrating to an unsupported Postgres version? Commented Nov 12, 2018 at 14:57
  • 1
    The equivalent is the CopyManager API see e.g. this question or this question Commented Nov 12, 2018 at 14:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.