MigrationSetting.jsp
12.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.*" %>
<%@ page import="weaver.upgradetool.dbupgrade.upgrade.PropUtil" %>
<%@ page import="weaver.upgradetool.dbupgrade.upgrade.UpgradeRecordSet" %>
<%@ include file="/system/upgradetoe9/DBUpgradeInit.jsp"%>
<html>
<%
%>
<script type="text/javascript" src="/system/upgradetoe9/js/jquery-1.8.3.min_wev8.js"></script>
<link rel="stylesheet" href="/system/upgradetoe9/css/seachBody_wev8.css" type="text/css" />
<!--弹出层 开始 -->
<link type="text/css" rel="stylesheet" href="/system/upgradetoe9/css/dialog.css" />
<script type="text/javascript" src="/system/upgradetoe9/js/dialog.js"></script>
<!--弹出层 结束 -->
<script type="text/javascript">
$("document").ready(function () {
$("input").focus(function(){
$("#next").attr('disabled',true);
$("#next").removeClass("e8_btn_submit");
$("#next").addClass("e8_btn_disabled");
})
});
</script>
<head>
<title> E-cology迁移程序</title>
<style>
TABLE {
FONT-SIZE: 9pt;
FONT-FAMILY: Verdana;
}
BODY {
FONT-SIZE: 9pt;
MARGIN: 0px;
FONT-FAMILY: Verdana;
LIST-STYLE-TYPE: circle;
}
table input{
border: 1px solid #ccc!important;
border-radius: 3px;/* !*css3属性IE不支持*!*/
padding: 6px 0px 5px 10px;
}
#dbform{
width: 100%;
height:auto;
vertical-align:center;
font-weight: bold;
}
.btn-disabled{
height: 35px;
text-decoration:none;
background:#959595;
color:black;
padding: 5px 20px 5px 20px;
font-size:16px;
font-family: 微软雅黑,宋体,Arial,Helvetica,Verdana,sans-serif;
/*font-weight:bold;*/
border-radius:5px;
-webkit-transition:all linear 0.10s;
-moz-transition:all linear 0.10s;
transition:all linear 0.10s;
}
.btn-success{
height: 35px;
text-decoration:none;
background:#5CB85C;
color:#f2f2f2;
padding: 5px 20px 5px 20px;
font-size:16px;
font-family: 微软雅黑,宋体,Arial,Helvetica,Verdana,sans-serif;
/*font-weight:bold;*/
border-radius:5px;
}
.btn-success:hover{
background:#449D44;
}
.e8_btn_disabled{
border:0px;cursor:pointer;
padding-left:0;
padding-left:10px;
padding-right:10px;
height:30px;
line-height:30px;
background-color:#959595;
color:white;
width:auto;
}
.e8_btn_submit{
border:0px;cursor:pointer;
padding-left:0;
padding-left:10px;
padding-right:10px;
height:30px;
line-height:30px;
background-color:#558ED5;
color:white;
width:auto;
}
.e8_btn_submit_hover{
background-color:#0170C1 !important;
color:white;
}
</style>
</head>
<%
String titlename = "";
PropUtil prop = PropUtil.getInstance();
String dbserver = Util.null2String(prop.getValues("dbserver"));
String dbport = Util.null2String(prop.getValues("dbport"));
String dbname = Util.null2String(prop.getValues("dbname"));
String username = Util.null2String(prop.getValues("username"));
UpgradeRecordSet rs=new UpgradeRecordSet();
String dbtype = Util.null2String(prop.getValues("dbtype"));
if("".equals(dbtype)){
dbtype=rs.getDBType().toLowerCase();
}
if("".equals(dbport)){
if(dbtype.equals("sqlserver")){
dbport="1433";
}else if(dbtype.equals("oracle")){
dbport="1521";
}
}
String sourcepath = Util.null2String(prop.getValues("sourcepath"));
%>
<jsp:include page="/system/upgradetoe9/CommonTabHead.jsp">
<jsp:param name="mouldID" value="upgrade"/>
<jsp:param name="step" value="<%=currentStep%>"/>
<jsp:param name="navName" value="数据库迁移工具"/>
</jsp:include>
<table id="topTitle" cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td class="rightSearchSpan" style="text-align:right; width:500px!important">
<button style="margin-right:10px;" id="next" type="button" name="next" disabled="true" onclick="next()" class="e8_btn_disabled">下一步</button>
</td>
</tr>
</table>
<body style="height:100%;width:100%;">
<div style="width:20%;height:100%;float:left;background:#fcfcfc;">
<jsp:include page="MigrationStep.jsp"></jsp:include>
</div>
<div style="width:75%;height:100%;float:right">
<div style="width: auto;margin-left: 50px">
<form>
<table id="dbform" cellspacing="10px" cellpadding="5px">
<colgroup>
<col width="20%">
<col width="80%">
</colgroup>
<tbody>
<th class=Separator>
<td style="height: 80px" ><h1>源数据库参数设置</h1></td>
</th>
<tr>
<td >验证码: </td>
<td><input id="verifycode" type="password" name="verifycode" value="" maxlength=16 size=40></td>
</tr>
<tr>
<td>数据库类型:</td>
<td>
<select id="dbtype" name="dbtype" onchange="changeDBType()">
<option value="1" <% if(dbtype.equals("sqlServer2000")) {%>selected<%}%>>SqlServer 2000</option>
<option value="2" <% if(dbtype.equals("sqlServer2005")) {%>selected<%}%>>SqlServer 2005</option>
<option value="3" <% if(dbtype.equals("sqlserver2008")) {%>selected<%}%>>SqlServer 2008</option>
<option value="4" <% if(dbtype.equals("sqlserver2014")) {%>selected<%}%>>SqlServer 2014</option>
<option value="5" <% if(dbtype.equals("oracle9i")) {%>selected<%}%>>Oracle 9i</option>
<option value="6" <% if(dbtype.equals("oracle10g")) {%>selected<%}%>>Oracle 10g</option>
<option value="7" <% if(dbtype.equals("oracle11g")) {%>selected<%}%>>Oracle 11g</option>
<option value="8" <% if(dbtype.equals("oracle12c")) {%>selected<%}%>>Oracle 12c</option>
<!--option value="3">DB2</option-->
<%-- <option value="4">Mysql</option>--%>
</select>
</td>
</tr>
<tr>
<td>数据库服务器IP:</td>
<td>
<input type="text" id="dbserver" name="dbserver" maxlength="40" value="<%=dbserver%>" size="40">
</td>
</tr>
<tr>
<td>数据库端口号:</td>
<td>
<input type="text" id="dbport" name="dbport" maxlength="40" size="40" value="<%=dbport%>">
</td>
</tr>
<tr>
<td>数据库名称:</td>
<td>
<input type="text" id="dbname" name="dbname" maxlength="40" size="40" value="<%=dbname%>">
</td>
</tr>
<tr>
<td>用户名:</td>
<td>
<input type="text" id="username" name="username" maxlength="40" size="40" value="<%=username%>">
</td>
</tr>
<tr>
<td>密码:</td>
<td>
<input type="password" id="password" name="password" maxlength="40" size="40" value="">
</td>
</tr>
<tr>
<td>
<input type="button" id="testConn" class="btn-success" value="测试连接" onclick="testConnection()" />
<td>
<input type="hidden" id="method" name="method" value="submit">
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</body>
</html>
<script type="text/javascript">
function testConnection(){
var verifycode =$("#verifycode").val();
var dbtype=$("#dbtype").val();
if(dbtype=='1'){
dbtype = 'sqlserver2000';
}else if(dbtype=='2'){
dbtype = 'sqlserver2005';
}else if(dbtype=='3'){
dbtype = 'sqlserver2008';
}else if(dbtype=='4'){
dbtype = 'sqlserver2014';
}else if(dbtype=='5'){
dbtype = 'oracle9i';
}else if(dbtype=='6'){
dbtype = 'oracle10g';
}else if(dbtype=='7'){
dbtype = 'oracle11g';
}else if(dbtype=='8'){
dbtype = 'oracle12c';
}
var dbserver=$("#dbserver").val();
var dbname= $("#dbname").val();
var dbport= $("#dbport").val();
var username=$("#username").val();
var password=$("#password").val();
var sourcepath=$("#sourcepath").val();
var checkResult = checkform(verifycode,dbtype,dbserver,dbname,dbport,username,password,sourcepath);
if(checkResult!=''){
$.DialogByZ.Alert({Title: "提示", Content: checkResult,BtnL:"确定"});
return;
}
$("#testConn").removeClass("btn-success");
$("#testConn").addClass("btn-disabled");
$("#testConn").attr('disabled',true);
$.ajax({
sync:false,
dataType:'json',
type:'post',
url:'MigrationSettingOperation.jsp?method=testConnection',
// timeout : 5000,
data:{
'verifycode': verifycode,
'dbtype': dbtype,
'dbserver': dbserver,
'dbname': dbname,
'dbport': dbport,
'username': username,
'password': password,
'sourcepath': sourcepath,
},
success:function(data){
var status = data.status;
var message = data.message;
$.DialogByZ.Alert({Title: "提示", Content: message,BtnL:"确定"});
if(status=='success'){
$("#next").attr('disabled',false);
$("#next").removeClass("e8_btn_disabled");
$("#next").addClass("e8_btn_submit");
}
$("#testConn").attr('disabled',false);
$("#testConn").removeClass("btn-disabled");
$("#testConn").addClass("btn-success");
},
error:function () {
$("#testConn").attr('disabled',false);
$("#testConn").removeClass("btn-disabled");
$("#testConn").addClass("btn-success");
}
/*,
complete : function(XMLHttpRequest,status){ //请求完成后最终执行参数
if(status=='timeout'){//超时,status还有success,error等值的情况
ajaxTimeoutTest.abort();
$.DialogByZ.Alert("超时");
}
}*/
});
};
function changeDBType() {
var dbtype=$("#dbtype").val();
if(dbtype>=1&&dbtype<=4) {
$('#dbport').val('1433');
}
else if(dbtype>=5&&dbtype<=8) {
$('#dbport').val('1521');
}
else if(dbtype==9) {
$('#dbport').val('3306');
}
};
function checkform(verifycode,dbtype,dbserver,dbname,dbport,username,password){
var message ='';
if(verifycode==""){
message="验证码不能为空!"
return message;
}
if(dbtype==""){
message="数据库类型不能为空!"
return message;
}
if(dbserver==""){
message="数据库服务器IP不能为空!"
return message;
}else{
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
if(!reg.test(dbserver)){
return "数据库服务器IP不合法!";
}
}
if(dbname==""){
message="数据库名称不能为空!"
return message;
}
if(dbport==""){
message="数据库端口号不能为空!"
return message;
}
if(username==""){
message="用户名不能为空!"
return message;
}
if(password==""){
message="密码不能为空!"
return message;
}
return message;
}
</script>