ODBC and CockroachDB

Hi,

is there support for ODBC and Cockroach or has someone got a working solution to hand that they would be happy to share ?

Thanks
Pete

Any Postgres driver, including an ODBC one, should work with crdb - basically you should connect to crdb just like you’d connect to a Postgres server. If it doesn’t work, please let us know.

Hello,

I had the same question and tried with the official Postgres ODBC driver (https://odbc.postgresql.org) against crdb v1.0, and I get this message trying to setup a DSN: ERROR: unknown variable: “datestyle”

I’m trying this on a Windows 2012 R2 server.

Any help is very appreciated.

Thanks,

Daniel

Filed as https://github.com/cockroachdb/cockroach/issues/17779. Thanks for reporting this limitation!

If you can find a way to disable the initialization of the datetime parameter in your ODBC settings, that may be sufficient to enable further compatibility.

Hi again! It appears we have already a fix for this issue in CockroachDB 1.1 (the next version to be released). Could you try with an alpha binary of 1.1 and confirm it works?

Hello,

I tried alpha 1.1 (Build Tag: v1.1-beta.20170907)
The “datestyle” error I was getting originally is gone, which is great, thanks! But I get a new error: unknown variable: “transaction_isolation”

Thanks,

Daniel.

Thanks for trying it out. Please provide more information about the new error:

  • does this happen when initially opening a connection, or only when you issue SQL queries via ODBC?
  • if the latter, can you report which SQL statements are sent to the server? You can find this out by starting cockroach with option --vmodule=executor=2.

Also if that is agreeable to you, I would invite you to create an issue on GitHub which would facilitate linking this issue to our code base. Thank you!

This happens when initially opening the connection, while testing the connection on the Windows ODBC Manager.

I’ve opened issue #18506.

Thanks and regards,

Daniel.

Do you have a sample connection string to connect to crdb in secure and insecure mode? Is the following a valid connection string?
Driver=postgresql;Server=localhost;Port=26257;Database=MYDB;Uid=root;sslmode=disable