<%@ page contentType="text/html;charset=gb2312"%>
<%@page import="java.sql.*"%>
<%@ page import="com.yc.ycportal.blockimp.service.SequenceService"%>
<%
PreparedStatement pssy=null;
Connection connsy=null;
ResultSet rssy=null;
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String urlsq="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=lyweb";
String usersq="sa";
String passwordsq="sa";
Connection connsq= DriverManager.getConnection(urlsq,usersq,passwordsq);
Class.forName("com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource").newInstance();
String urlsy="jdbc:sybase:Tds:10.165.0.65:4100/webdb";
String usersy="sa";
String passwordsy="sa";
connsy= DriverManager.getConnection(urlsy,usersy,passwordsy);
PreparedStatement pssq=null;
ResultSet rssq=null;
pssq=connsq.prepareStatement("select * from office");
rssq=pssq.executeQuery();
while(rssq.next())
{
String departid=rssq.getString("departid");
String departname = rssq.getString("departname");
if(departname==null)
departname="";
String postcord = rssq.getString("postcord");
if(postcord==null)
postcord="";
String address=rssq.getString("address");
if(address==null)
address="";
String tel = rssq.getString("tel");
if(tel==null)
tel="";
String leader = rssq.getString("leader");
if(leader==null)
leader="";
String departdescript=rssq.getString("departdescript");
if(departdescript==null)
departdescript="";
String parentid = rssq.getString("parentid");
if(parentid==null)
parentid="000";
pssy=connsy.prepareStatement("insert into office (departid,departname,postcord,address,tel,leader,departdescript,parentid) values(?,?,?,?,?,?,?,?)");
pssy.setString(1,new String(departid.getBytes("gb2312"),"ISO8859_1"));//新闻ID
pssy.setString(2,new String(departname.getBytes("gb2312"),"ISO8859_1"));//栏目ID
pssy.setString(3,new String(postcord.getBytes("gb2312"),"ISO8859_1"));//标题
pssy.setString(4,new String(address.getBytes("gb2312"),"ISO8859_1"));//副标题
pssy.setString(5,new String(tel.getBytes("gb2312"),"ISO8859_1"));//内容
pssy.setString(6,new String(leader.getBytes("gb2312"),"ISO8859_1"));//浏览量
pssy.setString(7,new String(departdescript.getBytes("gb2312"),"ISO8859_1"));//作者
pssy.setString(8,new String(parentid.getBytes("gb2312"),"ISO8859_1"));//发布者用户名
try
{
pssy.executeUpdate();
}
catch(Throwable t)
{
pssy=connsy.prepareStatement("update office set departname=?,postcord=?,address=?,tel=?,leader=?,departdescript=?,parentid=? where departid=?");
pssy.setString(1,new String(departname.getBytes("gb2312"),"ISO8859_1"));//栏目ID
pssy.setString(2,new String(postcord.getBytes("gb2312"),"ISO8859_1"));//标题
pssy.setString(3,new String(address.getBytes("gb2312"),"ISO8859_1"));//副标题
pssy.setString(4,new String(tel.getBytes("gb2312"),"ISO8859_1"));//内容
pssy.setString(5,new String(leader.getBytes("gb2312"),"ISO8859_1"));//浏览量
pssy.setString(6,new String(departdescript.getBytes("gb2312"),"ISO8859_1"));//作者
pssy.setString(7,new String(parentid.getBytes("gb2312"),"ISO8859_1"));//发布者用户名
pssy.setString(8,new String(departid.getBytes("gb2312"),"ISO8859_1"));
out.println(departname);
//pssy.executeUpdate();
}
}
%>