修改测试连接的验证方式

This commit is contained in:
mxd 2019-08-26 16:18:32 +08:00
parent c7a48a9457
commit cb2b798691

View File

@ -1,8 +1,8 @@
package org.spiderflow.websocket;
import java.sql.Connection;
import java.sql.DriverManager;
import javax.sql.DataSource;
import javax.websocket.OnMessage;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
@ -51,8 +51,8 @@ public class WebSocketEditorServer {
String password = dsConfig.getString("password");
Connection connection = null;
try{
DataSource ds = DataSourceUtils.createDataSource(className, url, username, password);
connection = ds.getConnection();
Class.forName(className);
connection = DriverManager.getConnection(url,username,password);
context.write(new WebSocketEvent<>("success", "测试连接成功!"));
}catch(Exception e){
context.write(new WebSocketEvent<>("error", "连接失败," + e.getMessage()));