在純DOS下,如何在C語言裏聯結數據庫:
目前個人想法:1)安裝DOS下的Oracle客戶端 -〉從哪裏獲取
2)在DOS下配置Oracle客戶端 -〉如何配置
3)在C中寫代碼連接        -〉怎麽寫
4)執行SQL語句。        -〉和window下的是否相同如果想法正確那麽後面的問題幫忙解答
如果想法錯誤那麽應該怎麽做。高手指點。
先謝謝了。

解决方案 »

  1.   

    to kingofworl:
    難道在DOS下不能連接Oracle數據庫?其他的高手,有沒有經驗啊!
      

  2.   

    在此聲明是純DOS,不是windows的CMD狀態Oracle數據庫服務器端是在Window下已經是正常的
    現在是問客戶端是DOS的話,能不能連這個Oracle數據庫。
      

  3.   

    dos下的oracle还没有见过顶一下
      

  4.   

    貌似装Oracle必须起图形界面,DOS怎么装?没客户端sqlplus也不好用阿
      

  5.   

    void connect(){
      printf("input your username:");
      gets(username);
      printf("input your password:");
      gets(password);
      printf("input your service name:");
      gets(server);
      exec sql connect :username identified by :password using :server;
    }
      

  6.   

    To young0x:
       请问这样写,不需要客户端的支持吗?
       还是C中要引用什么库?
      

  7.   

    看來oracle好像在DOS下是沒有辦法用了。
    但是還是要謝謝各位
      

  8.   

    听说oracle可以装在裸机上,不知道真的假的?
    一下引用oracle8i中的一段话
    Installing Oracle Products for Windows and DOS 
    Read this if you are installing your Oracle products for Windows onto a workstation that already has either DOS products or older Windows products. Oracle Home Directories 
    The Oracle Installer places most Oracle products for Windows into a separate Oracle home directory from Oracle products for DOS. The default Oracle home directory for Windows is \ORAWIN. The default Oracle home directory for DOS is either \ORADOS for products designed for the V3 Oracle Installer or \ORACLE6 for products that were designed for the V2 Oracle Installer. 
    Note: The default DOS Oracle home directory for products installed by the older V2 Oracle Installer is \ORACLE6. When a V2 directory structure is migrated to the V3 directory structure, the name of the directory remains the same. So, if the DOS directory name was \ORACLE6, it remains \ORACLE6. 
    However, some older Oracle and 3rd party products for Windows are installed in the Oracle home directory for DOS. These products include, but are not limited to, the following products: - Oracle Card for Windows 1.x - Oracle for Windows (DDE Manager/Toolbook Interface) 1.x - Run Form for Windows 3.x - Run Menu for Windows 5.x - SQL*Plus for Windows 3.0.x - Oracle Business Manager 1.x 
    If you use these products, you must follow the guidelines described in the following paragraphs to maintain compatibility with other Windows and DOS products. Configuration Files 
    Current Windows Oracle products look for configuration parameters in the ORACLE.INI file in your \WINDOWS directory. DOS Oracle products and older Windows products look for configuration parameters in the CONFIG.ORA file. The CONFIG.ORA file is located either in the \XBIN subdirectory of your V3 DOS Oracle home directory, or in your V2 Oracle home directory. Make sure that the following parameters in your ORACLE.INI file are duplicates of the parameters in you CONFIG.ORA file. - LOCAL - REMOTE - SQLNET DBNAME - INTERRUPT - TCP_SERVICES_FILE 
    If a parameter exists in one file and not the other, add the parameter to the file that does not contain it. If a parameter does not exist in either your ORACLE.INI file or CONFIG.ORA file, you do not need to add it to either file. If the parameter exists in both files, make sure they are set to the same value. 
    Also make sure that the SET CONFIG or SET CONFIG_FILES command in your AUTOEXEC.BAT file points to your CONFIG.ORA file, not your ORACLE.INI file. The Oracle Installer will warn you if your CONFIG environment variable is set incorrectly. For more information about the CONFIG variable, see your DOS products documentation. The DOS Path and Oracle Home for Windows 
    Since Oracle DLLs are now stored in the \ORAWIN\BIN directory and not the \ORACLE6\BIN directory, older Windows products and 3rd party products must be configured to use the DLLs in the new \ORAWIN\BIN directory. To do this, the Installer will ask you if you want it to modify your AUTOEXEC.BAT file to put the \ORAWIN\BIN directory on your DOS search path. Answer 'Yes' if you are using older Windows products that require new Oracle DLLs, or a combination of old and new Windows products that require the same DLLs. For example, you must put \ORAWIN\BIN on the DOS path if you are using Oracle Card 1.1 with a recent version of SQL*Net for Windows. ORA6WIN.DLL 
    Older Windows products and many 3rd party products are shipped with an ORA6WIN.DLL file, which enables these products to operate under Windows. You must make sure that the most recent version of this file is used by all these products. To do this, you should put the most recent ORA6WIN.DLL file in your \ORAWIN\BIN directory and you should delete or rename all other ORA6WIN.DLL files from your workstation and from other locations available to your workstation via your network. You should also make sure that the \ORAWIN\BIN directory is on your DOS path as described in the above paragraph. 
    If the installer detects obsolete ORA6WIN.DLL files, it will ask you if you want it to rename them. However, you also should check for this file yourself; the Installer will not search all possible locations. This is especially important if you are using products on a network. Running DOS Products within Windows 
    You may use Oracle DOS products within Windows provided you run SQLPME before starting Windows and run Windows in standard mode, not enhanced mode. However, to let Windows run, you must limit the amount of memory that SQLPME will use. Otherwise, SQLPME may use all available memory and prevent Windows from running. 
    In order to force a ceiling on how much memory SQLPME will use, add the following line to your CONFIG.ORA file in your DOS Oracle home directory: 
    DYNAMIC_MEMORY=X 
    This will force all ORACLE protected mode products for DOS to run in no more than X kilobytes of extended memory. Windows will then use the memory that is not used by SQLPME. Make sure you set X low enough to allow enough free memory for Windows to run and high enough to allow DOS Oracle products to run. Also, do not set X higher than 16000. 
    When running DOS Oracle products from within Windows you must use DOS SQL*Net, not Windows SQL*Net, to connect to a remote database. Windows SQL*Net products are only supported in Windows enhanced mode not standard mode. 
    If you are running Windows in enhanced mode, you cannot run DOS Oracle products within Windows. You must not run SQLPME before running Windows in enhanced mode. 
      

  9.   

    另外sqlplus不是只有在window模式下可以使用
    至少cmd下:sqlplus userid/pwd@uid这种方式一定不会有问题。
      

  10.   

    我见过dos下连接ctree数据库 
    然后和UNIX下的ORACLE连接的例子
    不知道对你的思路有没有帮助
      

  11.   

    TO doer_ljy(可战)
       請問這段話是在Oracle8i那個文檔上看呀?
    好像有點意思,我想找這個文檔仔細看看。
      

  12.   

    Oracle的手册
    挺大的,不知道那里可以下载到!
    应该是oracle的官方手册
      

  13.   

    我是从别人那里copy的。
    抬头是
    Oracle
    Product Documentation Library