[unixODBC-dev] SQLDriverConnectW() returns an error !

Anita Dixit anita_dixit at persistent.co.in
Thu Jun 23 11:15:27 BST 2005

Hi Nick,

Thanks for the prompt reply!
If I input the connection string as per below mentioned method, the program
indeed proceeds. However, now there is a bus error during the execution of
the same API - SQLDriverConnectW.

Stack frames show that unixODBC SQLDriverConnectW API calls the driver's
SQLDriverConnectW. This in turn calls the driver's own function but the
program fails for wcslen() function.

Do you think if anything is further missing in the sample program?

Thanks again.


-----Original Message-----
From: unixodbc-dev-bounces at easysoft.com
[mailto:unixodbc-dev-bounces at easysoft.com] On Behalf Of Nick Gorham
Sent: Thursday, June 23, 2005 2:16 PM
To: Development issues and topics for unixODBC
Subject: Re: [unixODBC-dev] SQLDriverConnectW() returns an error !

Anita Dixit wrote:

>I tried using 2.2.11. However the problem doesn't seem to resolve.
>Following is the code that I am trying out - 

I am not sure what wstrcpy you are using, but


will create a array of 4 byte characters. unixODBC by default, will use the
2 byte UNICODE as odbc does on windows, so you could try something like

void wstrconvert( SQLWCHAR *out, char *in ) {
        while( *in ) {
                *out++ = *in++;
        *out = 0;


memset( connectionInfoBuffer, 0, 1024);

And a further problem, you call

SQLGetDiagRecW( SQL_HANDLE_DBC, hdbc, i, sqlstate,
&sqlcode, message, 10000, &length)

but then call

printf( "SQLSTATE          = <%s>\n", sqlstate ) ;

Again, sqlstate and message will be a two byte UNICODE string.

Nick Gorham
Easysoft Limited
unixODBC-dev mailing list
unixODBC-dev at easysoft.com


This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful.

Warning: Although Persistent Systems Pvt. Ltd. has taken reasonable precautions to ensure no viruses are present in this email; the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.

More information about the unixODBC-dev mailing list