wood burning stoves 2.0*
The moose likes JDBC and the fly likes JDBC Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Error" Watch "JDBC Error" New topic
Author

JDBC Error

Anmol Mahatpurkar
Greenhorn

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
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

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.


Steve
Anmol Mahatpurkar
Greenhorn

Joined: Oct 23, 2013
Posts: 10

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

https://forums.oracle.com/message/10876669

http://stackoverflow.com/questions/9536694/java-64-bit-jdbc-odbc-driver-issues

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


http://muhammadkhojaye.blogspot.com/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JDBC Error