躺在沙灘上的小豬

          快樂的每一天

          #

          【收藏】朋友推薦的站點

          http://ftp.cdut.edu.cn/pub/linux/language/
          http://www.miex.org/python/

          posted @ 2005-09-20 13:34 martin xus| 編輯 收藏

          [收藏] [翻譯]Python Programming FAQ

          ??? http://wiki.woodpecker.org.cn/moin/PyProgFaq

          posted @ 2005-09-20 11:35 martin xus| 編輯 收藏

          python的強悍:)

          昨天的問題,終于知道了,是oracle8搞的鬼,懶的再去找什么驅動了。便想起了python
          幸好張駿 的幫忙,讓我從一知半解到寫出代碼。

          用python的代碼明顯簡潔多了,而且我喜歡代碼的靈活。

          import cx_Oracle 
          
          def parse(): 
              '''generate the content html''' 
          
              sql = '''select t.bz_code code, t.bz_title title, t.bz_content content 
                  from bz_czzs t 
                  order by t.bz_code''' 
          
              connection = cx_Oracle.connect( 'etasadmin/etasadmin@zhongju' ) 
              cursor = connection.cursor() 
              cursor.execute(sql) 
              item=cursor.fetchone() 
              i=1; 
              print 'begin' 
              while item: 
                  i+=1 
                  print 'parsing ',i,' item....' 
                  writeContent(item[0],item[1],str(item[2])) 
                  item=cursor.fetchone() 
          
              print 'end' 
          def writeContent(code,title,content): 
              filename='D:\\workspace\\style\\test\\content_body.html'    
              s = getContent(code,title,content)
              out = open(filename,'a') 
              out.write(s) 
              out.flush() 
              out.close() 
              
          if __name__=='__main__': 
              print 'parse..................'    
              parse() 
              print 'end'

          看樣子,要好好學習它了。
          python 真棒 o_o

          posted @ 2005-09-20 11:32 martin xus| 編輯 收藏

          oracle8 Clob 的問題

          注:問題已經解決,oracle8的問題,處理lob需要oci

          昨天處理數據的時候,遇到oracle的clob的問題。解決不了,郁悶。

          oracle.sql.CLOB clob = (oracle.sql.CLOB)  rs.getClob("content"); 
          Reader reader = rs.getCharacterStream("content"); 
          reader.read(c); 
          
          System.out.println("content:" + new String(c)); 
          
          if (null != clob && 0 < clob.length()) 
               System.out.println("content:" +
                       clob.getSubString((long) 1, (int) clob.length())); 
          else 
               System.out.println("nop");

          在這下面兩處,總是報錯。

          reader.read(c);

          clob.getSubString((long) 1, (int) clob.length())

          錯誤如下:

          java.io.IOException: 類型長度大于最大值 
                  at oracle.jdbc.dbaccess.DBError.SQLToIOException(DBError.java:716) 
                  at oracle.jdbc.driver.OracleClobReader.needChars(OracleClobReader.java:222) 
                  at oracle.jdbc.driver.OracleClobReader.read(OracleClobReader.java:163) 
                  at java.io.Reader.read(Reader.java:100) 
                  at com.jxlt.db.parse.Parse.parse(Parse.java:46) 
                  at com.jxlt.db.parse.Parse.main(Parse.java:79) 
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
                  at java.lang.reflect.Method.invoke(Method.java:324) 
                  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)

          google了一下 ,很多人說是驅動的問題,我用了oracle 9自己帶的class12&ojdbc14.jar都不行,到oracle站點下了 oralce 10g的驅動,同樣也是。

          posted @ 2005-09-19 09:09 martin xus| 編輯 收藏

          o_o

          申請了個blog :)thx blogjava!

          以前的一篇收藏的文章,放這里來
          ----------------------------------------------

          客戶提出的需求是能同時實現

          非實時查詢
          實時查詢
          沒有用過實現兩臺服務器的連接,google了一下。正好有:)留著

          url:http://www.softhouse.com.cn/html/200411/2004113009170200002474.html

          如何連接兩臺Oracle服務器

          軟件環(huán)境:

          1、Windows NT4.0+ORACLE 8.0.4
          2、ORACLE安裝路徑為:C:\ORANT
          3、服務器A、服務器B,均裝有NT 4.0中文版

          實現方法:

          1. 假設A地址192.1.1.1,B地址192.1.1.2

          2. A、B上配置好TCP/IP,互相Ping通。

          3. 配置init.ora文件,若global_name = true的話,database link 的名字必須同遠程機的實例名相同,

            為簡便起見,請將global_name 設為 false。

          4. 在服務器上配置tnsnames.ora,將Remote機器的地址(IP)信息加入本地的tnsnames.ora

            A服務器:

            TNSA_B =
             (DESCRIPTION =
              (ADDRESS_LIST =
                (ADDRESS =
                 (COMMUNITY = tcp.world)
                 (PROTOCOL = TCP)
                 (Host = 192.1.1.2)
                 (Port = 1521)
                )
              )
              (CONNECT_DATA = (SID = ORCL)
              )
             )

            B服務器:

            TNSB_A =
             (DESCRIPTION =
              (ADDRESS_LIST =
                (ADDRESS =
                 (COMMUNITY = tcp.world)
                 (PROTOCOL = TCP)
                 (Host = 192.1.1.1)
                 (Port = 1521)
                )
              )
              (CONNECT_DATA = (SID = ORCL)
              )
             )

          5. 在 SQL*Plus 或其它工具中創(chuàng)建數據庫鏈接

            A服務器:create public database link A_TO_B connect to tmp identified by tmp using 'TNSA_B';

            B服務器:create public database link B_TO_A connect to tmp identified by tmp using 'TNSB_A';

            說明:
            tmp是一個臨時用戶,A服務器、B服務器上均有,它的作用是提供鏈接的目的地,
            假如:
            B服務器上有user1、user2、tmp三個用戶,user1和user2把他們想要對外公開的表的權限授給tmp用戶,
            那么,所有能通過database link連接到tmp用戶上的人就可以直接訪問user1、user2上的已授權表了。

          6. 建立database link以后,請用這種格式select * from table_name@database_link_name 的方式訪問

            如:在A服務器上想訪問B服務器上user1用戶table1表的內容(A到B的連接為A_TO_B),則

            SQL> select * from table1@A_TO_B;

          7. 如果Oracle版本為7.3,則數據庫聯接寫法如下:

            A服務器:create public database link A_TO_B connect to tmp identified by tmp using 't:192.1.1.2:orcl';

            B服務器:create public database link B_TO_A connect to tmp identified by tmp using 't:192.1.1.1:orcl';

          posted @ 2005-09-18 16:19 martin xus| 編輯 收藏

          僅列出標題
          共28頁: First 上一頁 20 21 22 23 24 25 26 27 28 
          主站蜘蛛池模板: 田阳县| 塘沽区| 赣榆县| 朝阳县| 天全县| 青铜峡市| 房产| 河北省| 台湾省| 当雄县| 刚察县| 广州市| 松原市| 寻甸| 宝丰县| 桐城市| 定结县| 乐陵市| 威信县| 微山县| 泾源县| 宁阳县| 苍梧县| 淮北市| 凭祥市| 惠水县| 沁水县| 玉山县| 宁津县| 乡城县| 大邑县| 平谷区| 灵丘县| 阳城县| 蛟河市| 手机| 凭祥市| 江西省| 蓬安县| 邹平县| 左权县|