- 论坛徽章:
- 0
|
原创:用JDBC访问AS/400数据- 配置与JDBC编程要点
[quote]原帖由 "mario663"]我怎么找不到jt400.zip呀,我的Client Access 是英文版权所5.1,在安装显示AS/400 Toolbox for Java已安装,请那位高手指点,谢谢.[/quote 发表:
到目录"C:\Program Files\IBM\Client Access\jt400\lib\jt400.jar"中看一看,我的C/A是安装在C盘上的!
另外,请教楼主一问题,我用JAVA写了一个测试的小程序
代码如下:
- import java.io.*;
- import java.util.*;
- import com.ibm.as400.access.*;
- public class CommandCall extends Object{
- public static void main(String[] parmeters){
- //Created a reader to get input from the user
- BufferedReader inputStream = new BufferedReader(new InputStreamReader(System.in),1);
- //Declare varialbes to hold the system name and the command to run
- String systemString = null;
- String commandString = null;
-
- System.out.println("");
- //Get the system name and the command to run from the user
- try{
- System.out.print("System name:");
- systemString = inputStream.readLine();
- }
- catch (Exception e){};
- System.out.println("");
- //Create an as400 object.This is the system we send the command to
- AS400 as400 = new AS400(systemString);
- //Create a command call object specifying the server that will receive the command
- CommandCall command = new CommandCall(as400);
- //Run the command
- try{
- if (command.run(commandString))
- System.out.print("Command successful");
- else
- System.out.print("Command failed");
-
- //If messeage were produced from the command,print them
- AS400Messeage[] messeageList = command.getMesseageList();
- if (messeageList.length>;0){
- System.out.println(",messeage from the command:");
- System.out.print("");
- }
- for (int i=0;i<messeageList.length ;i++ ){
- System.out.print(messeageList[i].getID());
- System.out.print(":");
- System.out.print(messeageList[i].getText());
- }
- }
- catch (Exception e){
- System.out.println("Command" + command.getCommand() + "didn't run!");
- }
- System.exit(0);
- }
- }
复制代码
以下是报错信息:
- ---------- javac ----------
- CommandCall.java:23: cannot resolve symbol
- symbol : constructor CommandCall (com.ibm.as400.access.AS400)
- location: class CommandCall
- CommandCall command = new CommandCall(as400);
- ^
- CommandCall.java:26: cannot resolve symbol
- symbol : method run (java.lang.String)
- location: class CommandCall
- if (command.run(commandString))
- ^
- CommandCall.java:32: cannot resolve symbol
- symbol : class AS400Messeage
- location: class CommandCall
- AS400Messeage[] messeageList = command.getMesseageList();
- ^
- CommandCall.java:32: cannot resolve symbol
- symbol : method getMesseageList ()
- location: class CommandCall
- AS400Messeage[] messeageList = command.getMesseageList();
- ^
- CommandCall.java:44: cannot resolve symbol
- symbol : method getCommand ()
- location: class CommandCall
- System.out.println("Command" + command.getCommand() + "didn't run!");
- ^
- 5 errors
- Output completed (5 sec consumed) - Normal Termination
复制代码 |
|