SQLCODE -1024 [英] SQLCODE -1024

查看:202
本文介绍了SQLCODE -1024的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在完成DB2编程的第一步,所以请原谅

我的愚蠢问题。


我尝试使用嵌入式sql进行非常简单的第一次数据库访问,使用普通的

C代码(Windows上的MS-VC ++)。我做了一个简单的


EXEC SQL SELECT COUNT(*)

INTO:CNT

来自TESTTAB;


db2上的prep和bind没有错误,C代码编译和链接

errorfree也是。


运行时程序,我得到一个代码-1024(没有连接?)。什么

我要做什么来运行代码?我先在命令

窗口尝试了一个db2logon,但这没有帮助。


请帮帮我。


问候,

Gerd

解决方案

PS:我有一个提示,我是必须首先设置一些Windows环境

变量。它是否正确?如果,哪个变量,哪个价值?
值?

Gerd schrieb:

大家好,

我正在用DB2编程完成我的第一步,所以请原谅我的愚蠢问题。

我尝试使用嵌入式sql进行非常简单的第一次db-access用简单的C代码(Windows上的MS-VC ++)。我做了一个简单的EXEC SQL SELECT COUNT(*)
INTO:CNT
FROM TESTTAB;

db2上的prep和bind没有错误,C代码也编译和链接
errorfree。

运行程序时,我得到一个代码-1024(未连接?)。我有什么办法来运行代码?我首先在命令
窗口中尝试了db2logon,但这没有帮助。

请帮帮我。

问候,
Gerd



您是否安装了DB2 Connect?你有一个别名设置

连接到数据库?您是否使用配置客户端测试

连接?测试是否成功?

连接到DB2数据库需要一些信息来确定它,以及一个DB2客户端来进行连接。

信息输入一次,并分配一个别名。然后,连接

语句与别名一起使用来连接。


B.

是的,已安装DB2。我的别名是作为TESTDB创建的。我可以通过命令编辑器成功连接

,我可以成功提交选择

语句。如果我添加一个显式连接到我的代码(EXEC SQL CONNECT

TO TESTDB ...;),那么它的工作原理。但是,如果我没有探索连接但是

尝试一个implizit连接它不起作用。

我有一个答案说明我必须声明一些

环境变量(DB2DBDFT,DB2USER,DB2PASSWORD),但在执行

时我得到了另一个错误(请参阅我的其他帖子)。


Hi all,

I''m doing my very first steps with DB2 programming, so please forgive
me my stupid question.

I try a very simple first db-access using embedded sql with plain
C-code (MS-VC++ on windows). I did a simple

EXEC SQL SELECT COUNT (*)
INTO :CNT
FROM TESTTAB;

The prep and bind on db2 has no errors, the C-code compiles and links
errorfree, too.

When running the program, I get a code -1024 (not connected?). What
have I to do to run the code? I tried a db2logon in the command
window first, but this did not help.

Please help me.

Regards,
Gerd

解决方案

PS: I''ve got a hint, that I have to set some Windows environment
variables first. Is this correct? And if, which variables , which
values?

Gerd schrieb:

Hi all,

I''m doing my very first steps with DB2 programming, so please forgive
me my stupid question.

I try a very simple first db-access using embedded sql with plain
C-code (MS-VC++ on windows). I did a simple

EXEC SQL SELECT COUNT (*)
INTO :CNT
FROM TESTTAB;

The prep and bind on db2 has no errors, the C-code compiles and links
errorfree, too.

When running the program, I get a code -1024 (not connected?). What
have I to do to run the code? I tried a db2logon in the command
window first, but this did not help.

Please help me.

Regards,
Gerd




Do you have DB2 Connect installed? Do you have an alias setup to
connect to the database? Did you use the configuration client to "test"
the connection? Was the test succesful?

Connecting to a DB2 database takes a few pieces of information to
identify it, and a DB2 client to do the connection itself. The
information is input once, and assigned an alias. Then, a connect
statement is used with the alias to connect.

B.


Yes, DB2 is installed. My alias is created as TESTDB. I can connect
successfully via command editor and I can successfully submit select
statements. If I add an explicit connect to my code (EXEC SQL CONNECT
TO TESTDB ... ;) then it works. But if I do not explizitly connect but
try an implizit connect it does not work.
I''ve got an answer stating that I would have to declare some
environment variables (DB2DBDFT, DB2USER, DB2PASSWORD), but when doing
this I get an other error (see my other thread).


这篇关于SQLCODE -1024的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆