Meaningless Drivel is fun!
The moose likes JDBC and Relational Databases and the fly likes JDBC Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC Error" Watch "JDBC Error" New topic

JDBC Error

Anmol Mahatpurkar

Joined: Oct 23, 2013
Posts: 10

Hey guys,

I get this error on the console whenever running any JDBC code on my computer.

[Microsoft][ODBC Driver Manager] Invalid string or buffer length

I am running this on a 64-bit windows 7 OS. People on some websites say that this is a problem caused due to the buffer alignment of 64 bit Operating Systems.

Can someone please explain in detail, why and when is this error caused and what can be done to solve it?
Steve Luke

Joined: Jan 28, 2003
Posts: 4181

First: who are 'some people' and where do they say it? Links and references would be helpful for context.

Second: along the same lines, an error in isolation is usually not very informative. The only think we would be able to say from the error is that the string is invalid or perhaps there has an invalid buffer length. More information about when you see the error, when you don't, etc... might help the discussion.

Anmol Mahatpurkar

Joined: Oct 23, 2013
Posts: 10

Here are some links where I came across the same issue...

Sorry for not being clear about my problem.

Whenever I run any code which uses the JDBC - ODBC Driver to connect to a Microsoft SQL Server database using a 64 bit OS, I get the following error:

[Microsoft][ODBC Driver Manager] Invalid string or buffer length

But when I run the same code without making any changes, on a 32 bit OS having a 32 bit JVM, the code works properly and gives me the desired result.

The error is displayed only when I try to run the program on a 64 bit OS.
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 449

Can you verify whether the current JDBC - ODBC Driver is compatible to 64 bit environment? Also, I suggest to switch to any other connector to test which compatible with 64bit environment
I agree. Here's the link:
subject: JDBC Error
It's not a secret anymore!