0

I wish to upload my text data from client application to server database. Right now, i'm using ODBC to communicate with PostgreSQL. I use ODBC because there is a need to connect to multiple type of databases.

My issue here is, PostgreSQL uses PQgetCopyData to obtain the stdout data when using COPY OUT. So, is there any workaround to obtain the data from output stream without using libpq API and transmit it over by :

SQLExecDirect (hStmst,"COPY <table> FROM STDIN WITH CSV ",SQL_NTS)

?

1 Answer 1

1

Basically you have two options. The first is to use the old COPY command (borrowed from Quel interestingly enough). The second is to use a CSV parsing library of your choice and generate INSERT statements.

The tradeoff is that COPY will work MUCH faster, whine INSERT will work on other databases too.

Sign up to request clarification or add additional context in comments.

Comments

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.