I have a JAVA method that executes the following query to SQL server database

SELECT [CHEMICAL_NAME],[CHEMI_UNIT],[PRICE],[VENDOR],[CATEGORY]FROM [RPS].[dbo].[Chemicals]where CATALOGNO = '" + catNo+"' ;";

Following are the column names of the database table

CATALOGNO, CAS_NO, CHEMICAL_NAME, CHEMI_UNIT, PRICE, VENDOR, CATEGORY,

I get the above mentioned error "com.microsoft.sqlserver.jdbc.SQLServerException: The column name CATALOGNO is not valid." The query by itself executes perfectly fine when I run it from SQL server query window.

cross check if the column name is CATALOGNO or CATALOG_NO

commented: It worths a check +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.