Thursday, July 09, 2009

心的方向

追逐风追逐太阳,在人生的大道上
追逐我的理想
我得方向就在前方....
早上打车的时候听到了这首周华健的老歌,有股年轻的冲动

现在,where is 心的方向?

Thursday, June 25, 2009

娘子,亲一个

娘子,全球通得网站现在不能发在线短信,我就email给你发吧。今天干啥了?稿子弄完没?我晚上有Social dinner,又得吃个2-3小时。想你!

Tuesday, June 09, 2009

效率低下

一早上效率低下,PPT搞了半天也没弄完。饿了,等着吃午饭了。

Sunday, June 07, 2009

终于出手了

想买台单反相机很久了,虽然有部EOS630,可是部胶片相机,比较费钱。关注40D有一年的,哼哼唧唧,犹犹豫豫一直没有买。昨天老婆突然问,你的相机什么时候买。我一狠心,择日不如撞日,就今天了。中午从网上查好40D机身价钱,网上直接下单,晚上去soho现代城拿货交钱。镜头还是用的老胶片机上的。Canon不错,89年的机子,镜头现在还能通用在新机型上。
回家了,就是一顿乱拍,终于有了单反数码相机。去法国可以带上了:-)

Thursday, June 04, 2009

RJDBC connect Oracle

library(RJDBC)

# point the R package at the appropriate java driver class, as well as the class file
drv<-JDBC(”oracle.jdbc.driver.OracleDriver”, “/location/of/ojdbc14.jar”)
# the “easy” connection string spec for oracle db’s
conn<-dbConnect(drv, “jdbc:oracle:thin:@<host>:<port default=1521>:<SID>”,”username”,”password”)

# etc…
query = “SELECT * FROM A TABLE”
dbGetQuery(conn, query)

Saturday, May 30, 2009

今天

周六,中午和老婆陪姐姐去东坡吃了饭,之后去潘家园眼镜城给姐挑眼镜,未果。晚上姐夫来家住。明天还可以休一天,很好。

Friday, May 22, 2009

jython connect oracle via jdbc[ZT]

下载

http://jaist.dl.sourceforge.net/sourceforge/zxjdbc/zxJDBC-2.1.tar.gz

http://jaist.dl.sourceforge.net/sourceforge/jython/jython_installer-2.2.1.jar

根据自己的jdk版本下载对应的ojdbc版本

http://download.oracle.com/otn/utilities_drivers/jdbc/10203/ojdbc14.jar

http://download.oracle.com/otn/utilities_drivers/jdbc/111060/lib/ojdbc5.jar

http://download.oracle.com/otn/utilities_drivers/jdbc/111060/lib/ojdbc6.jar

安装(需要已经安装了jdk/jre?)

java -jar jython_installer-2.2.1.jar 安装到C:\jython2.2.1

将zxJDBC.jar解压缩到c:\tmp

将mm.mysql-2.0.4-bin.jar复制到c:\tmp

C:\jython2.2.1>set CLASSPATH=c:\tmp\ojdbc5.jar;c:\tmp\zxJDBC.jar;%CLASSPATH%

启动Oracle服务器:

进入jython环境访问Oracle

编辑文件c:\tmp\ora.py

from oracle.jdbc.driver import OracleDriver
from java.sql import DriverManager


def connect(un, pw, sid, host, port):
driver = OracleDriver()
DriverManager.registerDriver(driver)
connection = "jdbc:oracle:thin:@%s:%s:%s" % (host, port, sid)
conn = DriverManager.getConnection(connection, un, pw)
return conn

def doStuff(conn):
stmt = conn.createStatement()
rset = stmt.executeQuery("SELECT banner FROM sys.v_$version")
while (rset.next()):
print rset.getString(1)
stmt.close()

if __name__ == "__main__":
un = 'ebc20'
pw = 'abc'
sid = 'abc'
host = '10.4.231.16'
port = '1521'
conn = connect(un, pw, sid, host, port)
doStuff(conn)


C:\jython2.2.1>jython \tmp\ora.py
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for HPUX: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

然后用jython自己封装的dbexts库。

最后编辑一个名为dbexts.ini的文件保存到c:\jython2.2.1\lib。

[default]
name=mysqltest

[jdbc]
name=ora
url=jdbc:oracle:thin:@10.4.231.16:1521:abc
user=ebc20
pwd=abc
driver=oracle.jdbc.driver.OracleDriver
datahandler=com.ziclix.python.sql.handler.OracleDataHandler

进入jython

>>> from dbexts import dbexts
>>> oracon = dbexts("ora", "c:\jython2.2.1\lib\dbexts.ini")

>>> oracon.isql("SELECT * FROM v$version")


BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for HPUX: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

5 rows affected