MySQL Forums
Forum List  »  Connector/ODBC

ODBC not connecting to MS sql server from an OSX system. ODBC_API.SQLGetDiagRecW shows state as 0
Posted by: Raj B
Date: December 19, 2013 04:54PM

Hi,
So I am trying to connect to a corporate MS database from my Mac OSX based machine from within the corporate network.I've verified freetds works fine.
I've also used macports to install them and placed the appropriate odbc.ini and odbcinst.ini files.

But when I try connecting using -

ret = ODBC_API.SQLDriverConnectW(self.dbc_h, 0, c_connectString, len(self.connectString), None, 0, None, SQL_DRIVER_NOPROMPT)

I get a return value of -1(SQL_ERROR) .I try to further root cause this by adding the following error check -



if ret == SQL_ERROR:
stateE = create_buffer_u(22)
MessageE = create_buffer_u(1024*4)
ODBC_funcE = ODBC_API.SQLGetDiagRecW
raw_sE = unicode
NativeErrorE = ctypes.c_int()
Buffer_lenE = c_short()
val = ODBC_funcE(SQL_HANDLE_DBC, self.dbc_h,1, stateE,ADDR(NativeErrorE), MessageE, 1024, ADDR(Buffer_lenE))
print val
print MessageE.value
print stateE.value
print NativeErrorE.value

The stateE value is being printed to be 0.The messageE.value is a very odd '[' and NativeErrorE returns a value of 20013.Can someone point me to what these values mean and how to debug this further?

Options: ReplyQuote


Subject
Written By
Posted
ODBC not connecting to MS sql server from an OSX system. ODBC_API.SQLGetDiagRecW shows state as 0
December 19, 2013 04:54PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.