I'm running a test COBOL program to verify that I can connected to my SQLServer 2005 DB and select data. The connection works (SQLCODE = 0) on connect, but when the COBOL program executes a valid SELECT statement, it returns an SQLCODE = -1 (negative 1). I'm using the sqljdbc4.jar driver, and I'm running in MicroFocus compatibility mode.
The MicroFocus COBOL documentation states the following for SQLCODE -1:
"SQL(INIT) was used, and automatic CONNECT failed. Programs which use SQL(INIT) need to check SQLCODE immediately on startup."
Any ideas on why my select is not working?
Ensure the JDBC driver you're using works with the SQL Server version. For example, SQL Server JDBC version 4 driver won't work with SQL Server 2005, according to the Microsoft site. Either upgrade your database or downgrade your driver.