I have the same exact problem. I'm running MATLAB R2009a 64-bit for Windows on MS Vista Enterprise SP2. I'm trying to connect to a database on MS Windows Server 2008 Enterprise SP1 with the SQL Server Native Client 10.0 ODBC driver (version 2007.100.2531.00 dated 3/30/2009). When I run Visual Query Builder and choose the ODBC datasource, a datasource UserName and Password window pops up despite the fact that my datasource uses Windows authentication. If I enter a valid UserName and password an Error Dialog window pops up with the message "[Microsoft][ODBC Driver Manager] Invalid string or buffer length. I'm doing this with a domain administrator account.
In order to diagnose the problem, I tried running a trace using the ODBC Data Source Administrator. After I enabled the trace a very odd thing happened. When I picked my ODBC datasource in Visual Query Builder, a busy mouse pointer was displayed for about 2 minutes. Then a list of tables were shown as would normally happen. So enabling the trace actually fixed my original problem! When I then picked a table in Visual Query Builder however, I received an error window [Microsoft][SQL Server Native Client 10.0][SQL Server] Invalid object name. So it wasn't a total success but I was able to avoid the original error. I'm not sure what to make of this. Somehow enabling the trace allowed Windows Authentication to work for the datasource. When you enable a trace, things slow down because information is written to a log. Somehow this allowed the ODBC client to authenticate.
I also tried to connect using the "SQL Server" driver rather than the "SQL Server Native Client 10.0" driver. I received the same results. I was able to get the JDBC driver to work without any problems for SQL Server. I still can not get the ODBC driver to work. I'm guessing the problem is an authentication issue rather than an "invalid string or buffer length" issue as the error message indicates. I've tried several other things like dropping my firewall and using different credentials without any success. Has anyone else had these problems and found a solution? Any suggestions on how to fix it would be appreciated.
Thanks,
Jeff
"John " <johnhealy100@hotmail.com> wrote in message <h0qo95$frt$1@fred.mathworks.com>...
> Hi all,
>
> Having quite an annoying problem with the database toolkit which I am using for the first time. I have created a datasource and try connecting using the command database(‘testDB, ‘testDB’, ‘testDB_password’). However, this keeps returning the following error:
>
> ans =
>
> Instance: 'testDB'
> UserName: 'testDB'
> Driver: []
> URL: []
> Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
> Message: '[Microsoft][ODBC Driver Manager] Invalid string or buffer length'
> Handle: 0
> TimeOut: []
> AutoCommit: 'off'
> Type: 'Database Object'
>
> I can find nothing in reference to this error for the toolkit, does anyone have any ideas?
>
> When I specify an incorrect password it returns with incorrect password dialog so I presume that a connection of some sort is being made. I am connecting using an ODBC user using SQL 2008 x64 and client running vista ultimate x64, anyone’s help or experience with this would be greatly appreciated as I have reached a bit of a dead end before I am even off the starting blocks!!
>
> Many thanks,
>
> J Healy
In order to diagnose the problem, I tried running a trace using the ODBC Data Source Administrator. After I enabled the trace a very odd thing happened. When I picked my ODBC datasource in Visual Query Builder, a busy mouse pointer was displayed for about 2 minutes. Then a list of tables were shown as would normally happen. So enabling the trace actually fixed my original problem! When I then picked a table in Visual Query Builder however, I received an error window [Microsoft][SQL Server Native Client 10.0][SQL Server] Invalid object name. So it wasn't a total success but I was able to avoid the original error. I'm not sure what to make of this. Somehow enabling the trace allowed Windows Authentication to work for the datasource. When you enable a trace, things slow down because information is written to a log. Somehow this allowed the ODBC client to authenticate.
I also tried to connect using the "SQL Server" driver rather than the "SQL Server Native Client 10.0" driver. I received the same results. I was able to get the JDBC driver to work without any problems for SQL Server. I still can not get the ODBC driver to work. I'm guessing the problem is an authentication issue rather than an "invalid string or buffer length" issue as the error message indicates. I've tried several other things like dropping my firewall and using different credentials without any success. Has anyone else had these problems and found a solution? Any suggestions on how to fix it would be appreciated.
Thanks,
Jeff
"John " <johnhealy100@hotmail.com> wrote in message <h0qo95$frt$1@fred.mathworks.com>...
> Hi all,
>
> Having quite an annoying problem with the database toolkit which I am using for the first time. I have created a datasource and try connecting using the command database(‘testDB, ‘testDB’, ‘testDB_password’). However, this keeps returning the following error:
>
> ans =
>
> Instance: 'testDB'
> UserName: 'testDB'
> Driver: []
> URL: []
> Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
> Message: '[Microsoft][ODBC Driver Manager] Invalid string or buffer length'
> Handle: 0
> TimeOut: []
> AutoCommit: 'off'
> Type: 'Database Object'
>
> I can find nothing in reference to this error for the toolkit, does anyone have any ideas?
>
> When I specify an incorrect password it returns with incorrect password dialog so I presume that a connection of some sort is being made. I am connecting using an ODBC user using SQL 2008 x64 and client running vista ultimate x64, anyone’s help or experience with this would be greatly appreciated as I have reached a bit of a dead end before I am even off the starting blocks!!
>
> Many thanks,
>
> J Healy