Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

MS Access DB with Spaces in Column Name

843859Jul 17 2007 — edited Aug 1 2007
Good Afternoon-

I'm having some serious headaches with a table that I need to extract information from. The powers that be wrote it with the following column names "Contract Number" , "Customer Number", "Description".

Note the spaces in the columns.
Sample code from here: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2691&lngWId=2

I'm using sample code for connecting to the database and I can access everything using the select statements, except if the column contains a space. I get the following errors:

s.execute("select [Customer Number], Name from Customer");
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.


s.execute("select \"Customer Number\", Name from Customer");
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

s.execute("select Customer*Number, Name from Customer");
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.

s.execute("select 'Customer Number' , Name from Customer");
Data from column_name: Customer Number , Unknown

This works, but would require parsing-
s.execute("select * from Customer");
Data from column_name: 5 , Unknown


Suggestions would be truly appreciated.

Jason
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2007
Added on Jul 17 2007
9 comments
516 views