将jdbc的驱动程序放到服务器的类路径里,然后要在数据库里建一个表test,有两个字段比如为test1,test2,可以用下面SQL建 create table test(test1 varchar(20),test2 varchar(20),然后向这个表写入一条测试纪录,那么现在开始我们的jsp和数据库之旅吧。
一、jsp连接Oracle8/8i/9i数据库(用thin模式)
testoracle.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";
//orcl为你的数据库的SID
String user="scott";
String password="tiger";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
二、jsp连接Sql Server7.0/2000数据库
testsqlserver.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";
//pubs为你的数据库的
String user="sa";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
三、jsp连接DB2数据库
testdb2.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
String url="jdbc:db2://localhost:5000/sample";
//sample为你的数据库名
String user="admin";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
四、jsp连接Informix数据库
testinformix.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("com.informix.jdbc.IfxDriver").newInstance();
String url =
"jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver;
user=testuser;password=testpassword";
//testDB为你的数据库名
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
五、jsp连接Access数据库
<%@page import="java.sql.*"
import ="java.util.*"
import ="java.io.*"
import="java.text.*"
contentType="text/html; charset=gb2312"
buffer="20kb"
%><%! int all,i,m_count;
String odbcQuery;
Connection odbcconn;
Statement odbcstmt;
ResultSet odbcrs;
String username,title,content,work,email,url,time,date;
String datetime;
%>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch (ClassNotFoundException e)
{ out.print ("驱动程序不存在");
}
try{
odbcconn = DriverManager.getConnection("jdbc:odbc:db1");
odbcstmt = odbcconn.createStatement();
odbcQuery="Select * From book where datetime>2001-4-26 Order By datetime DESC";
odbcrs=odbcstmt.executeQuery(odbcQuery);
int i=0;
while (i<130) odbcrs.next();
while (odbcrs.next())
{
//*/////////////////////////显示数据库的内容用于调试程序是用//
int ii;
try{
try{
for (ii=1;;ii++)
out.print ("<br>Cloumn "+ii+" is: "+odbcrs.getString(ii));
}catch (NullPointerException e) {
out.print ("有空的指针");
}
}catch (SQLException e){
}
}
odbcrs.close();
odbcstmt.close();
odbcconn.close();
}catch (SQLException e)
{ out.print (e);
}
%>
2008年11月18日星期二
Senior technical lead
Job ID: SWG-0186873
Job type: Full-time Regular
Work country: China
Posted: 10-Sep-2008
Work city: Shanghai
Job area: Software Development
Travel: up to 10%; travelling 1 day a week
Job category: Software Development & Support
Business unit: WPLC
Job role: Technical Support Professional
Job role skillset: General
Job description BU Description:IBM Workplace Portal and Collaboration (WPLC - Lotus)
BU is responsible for developing IBM's collaborative technology and solutions which integrate people, data and business processes to create the "human side" of IBM's On Demand and SOA strategies. We are inviting talents to share our enjoyment of developing Lotus Mashups, one of components of IBM Mashup Center. IBM Mashup Center, as the first integrated enterprise Web 2.0 mashup software platform in the industry, is a complete end-to-end mashup platform, supporting line-of-business assembly of simple, flexible, and dynamic Web applications, with the management, security, and governance capabilities that IT requires. Within this project, developers/testers will have opportunity to develop deep skills and knowledge in J2EE, Web2.0, and will work closely with worldwide senior technical people.
Developer lead:
• Lead the communication and collaboration with worldwide labs, and facilitate conference call with US teams.
• Analyze requirements, design and implementation of new features.
• Develop full owned code for product new release
• Work across organization boundaries to achieve objectives.
• Work as a technical leader to either lead a team to complete the software development project tasks..
• Passionate to software development. An independent, assertive, self-motivated, creative, dynamic, and flexible approach is required, whilst offering and open to new ideas.
Tech Skills:
• Rich programming skills in Java, J2EE, and AJAX
http://en.wikipedia.org/wiki/Ajax_(programming)
http://en.wikipedia.org/wiki/J2ee
• Familiar with software development and software development process
• Solid Knowledge or rich experiences in following fields is a strong plus:
• Web Application Development -- HTML/CSS/JavaScript/JSP
• Hands-on experience on AJAX framework/toolkits such as Dojo, jQuery, YUI, prototype, etc.
http://en.wikipedia.org/wiki/List_of_Ajax_frameworks
• OGSI, eclipse equinox
• WebSphere Application Server public Java API and programming extensions
• iBatis/Hibernate. IBM DB2, Oracle, Microsoft SQL Server
http://ibatis.apache.org/
http://en.wikipedia.org/wiki/Hibernate_(Java)
Soft Skills
• Strong English communication in writing, listening and speaking
• Strong technique leadership and assertive thinking
• Strong communication and team work skills
• Self-motivated
• Strong analytical and troubleshooting skills
• Quick learner and good flexibility
• Having strong sense of ownership and high accountabilityMaster degree or above in Computer Science & Technology or equivalent,
Required
Master's Degree
English: Fluent
Chinese simplified: Fluent
IBM is committed to creating a diverse environment and is proud to be an equal opportunity employer. All qualified applicants will receive consideration for employment without regard to race, color, religion, gender, gender identity or expression, sexual orientation, national origin, genetics, disability, age, or veteran status.
Job type: Full-time Regular
Work country: China
Posted: 10-Sep-2008
Work city: Shanghai
Job area: Software Development
Travel: up to 10%; travelling 1 day a week
Job category: Software Development & Support
Business unit: WPLC
Job role: Technical Support Professional
Job role skillset: General
Job description BU Description:IBM Workplace Portal and Collaboration (WPLC - Lotus)
BU is responsible for developing IBM's collaborative technology and solutions which integrate people, data and business processes to create the "human side" of IBM's On Demand and SOA strategies. We are inviting talents to share our enjoyment of developing Lotus Mashups, one of components of IBM Mashup Center. IBM Mashup Center, as the first integrated enterprise Web 2.0 mashup software platform in the industry, is a complete end-to-end mashup platform, supporting line-of-business assembly of simple, flexible, and dynamic Web applications, with the management, security, and governance capabilities that IT requires. Within this project, developers/testers will have opportunity to develop deep skills and knowledge in J2EE, Web2.0, and will work closely with worldwide senior technical people.
Developer lead:
• Lead the communication and collaboration with worldwide labs, and facilitate conference call with US teams.
• Analyze requirements, design and implementation of new features.
• Develop full owned code for product new release
• Work across organization boundaries to achieve objectives.
• Work as a technical leader to either lead a team to complete the software development project tasks..
• Passionate to software development. An independent, assertive, self-motivated, creative, dynamic, and flexible approach is required, whilst offering and open to new ideas.
Tech Skills:
• Rich programming skills in Java, J2EE, and AJAX
http://en.wikipedia.org/wiki/Ajax_(programming)
http://en.wikipedia.org/wiki/J2ee
• Familiar with software development and software development process
• Solid Knowledge or rich experiences in following fields is a strong plus:
• Web Application Development -- HTML/CSS/JavaScript/JSP
• Hands-on experience on AJAX framework/toolkits such as Dojo, jQuery, YUI, prototype, etc.
http://en.wikipedia.org/wiki/List_of_Ajax_frameworks
• OGSI, eclipse equinox
• WebSphere Application Server public Java API and programming extensions
• iBatis/Hibernate. IBM DB2, Oracle, Microsoft SQL Server
http://ibatis.apache.org/
http://en.wikipedia.org/wiki/Hibernate_(Java)
Soft Skills
• Strong English communication in writing, listening and speaking
• Strong technique leadership and assertive thinking
• Strong communication and team work skills
• Self-motivated
• Strong analytical and troubleshooting skills
• Quick learner and good flexibility
• Having strong sense of ownership and high accountabilityMaster degree or above in Computer Science & Technology or equivalent,
Required
Master's Degree
English: Fluent
Chinese simplified: Fluent
IBM is committed to creating a diverse environment and is proud to be an equal opportunity employer. All qualified applicants will receive consideration for employment without regard to race, color, religion, gender, gender identity or expression, sexual orientation, national origin, genetics, disability, age, or veteran status.
2008年11月14日星期五
2008年11月11日星期二
使用OpenSSL制作PKI数字证书
十年前就使用过OpenSSL了,这个加密工具和算法包非常强大和丰富。不过至今仍不能清楚记得命令行的具体参数,需要用的时候总免不了要翻翻手册,这里做一个简单的笔记。
1.首先要生成服务器端的私钥(key文件):
openssl genrsa -des3 -out server.key 1024
运行时会提示输入密码,此密码用于加密key文件(参数des3便是指加密算法,当然也可以选用其他你认为安全的算法.),以后每当需读取此文件(通过openssl提供的命令或API)都需输入口令.如果觉得不方便,也可以去除这个口令,但一定要采取其他的保护措施!
去除key文件口令的命令:
openssl rsa -in server.key -out server.key
2.openssl req -new -key server.key -out server.csr -config openssl.cnf
生成Certificate Signing Request(CSR),生成的csr文件交给CA签名后形成服务端自己的证书.屏幕上将有提示,依照其指示一步一步输入要求的个人信息即可.
3.对客户端也作同样的命令生成key及csr文件:
openssl genrsa -des3 -out client.key 1024
openssl req -new -key client.key -out client.csr -config openssl.cnf
4.CSR文件必须有CA的签名才可形成证书.可将此文件发送到verisign等地方由它验证,要交一大笔钱,何不自己做CA呢.
openssl req -new -x509 -keyout ca.key -out ca.crt -config openssl.cnf
5.用生成的CA的证书为刚才生成的server.csr,client.csr文件签名:
Openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config openssl.cnf
Openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cnf
现在我们所需的全部文件便生成了.
另:
client使用的文件有:ca.crt,client.crt,client.key
server使用的文件有:ca.crt,server.crt,server.key
.crt文件和.key可以合到一个文件里面,把2个文件合成了一个.pem文件,直接拷贝过去即可。
1.首先要生成服务器端的私钥(key文件):
openssl genrsa -des3 -out server.key 1024
运行时会提示输入密码,此密码用于加密key文件(参数des3便是指加密算法,当然也可以选用其他你认为安全的算法.),以后每当需读取此文件(通过openssl提供的命令或API)都需输入口令.如果觉得不方便,也可以去除这个口令,但一定要采取其他的保护措施!
去除key文件口令的命令:
openssl rsa -in server.key -out server.key
2.openssl req -new -key server.key -out server.csr -config openssl.cnf
生成Certificate Signing Request(CSR),生成的csr文件交给CA签名后形成服务端自己的证书.屏幕上将有提示,依照其指示一步一步输入要求的个人信息即可.
3.对客户端也作同样的命令生成key及csr文件:
openssl genrsa -des3 -out client.key 1024
openssl req -new -key client.key -out client.csr -config openssl.cnf
4.CSR文件必须有CA的签名才可形成证书.可将此文件发送到verisign等地方由它验证,要交一大笔钱,何不自己做CA呢.
openssl req -new -x509 -keyout ca.key -out ca.crt -config openssl.cnf
5.用生成的CA的证书为刚才生成的server.csr,client.csr文件签名:
Openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config openssl.cnf
Openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cnf
现在我们所需的全部文件便生成了.
另:
client使用的文件有:ca.crt,client.crt,client.key
server使用的文件有:ca.crt,server.crt,server.key
.crt文件和.key可以合到一个文件里面,把2个文件合成了一个.pem文件,直接拷贝过去即可。
IBM技术以及职位相关信息
软件下载资源中心
http://www.ibm.com/developerworks/cn/downloads/index.html
Eclipse开发环境开源项目
http://www.eclipse.org/
IBM职位招聘信息
https://jobs3.netmedia1.com/cp/search.jsp?tc=1199340560188
IBM IT架构师职位要求 链接
http://www.ibm.com/developerworks/cn/downloads/index.html
Eclipse开发环境开源项目
http://www.eclipse.org/
IBM职位招聘信息
https://jobs3.netmedia1.com/cp/search.jsp?tc=1199340560188
IBM IT架构师职位要求 链接
订阅:
博文 (Atom)