谁写过DB2的JNDI连接 schema属性怎么写进去
1个回答
2014-11-29 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:117538
获赞数:517190
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注
展开全部
package com.ssss.gggg.test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class CreatOfRoster {
// get chat db properties from openfire global property API
public static final String DB_CONNECT_URL = "jdbc:db2://10.23.250.41:50000/isse2:currentSchema=cssde;";
public static final String DB_USER = "root2";
public static final String DB_PASSWORD = "root2";
// 创建好友关系ROSTER的sql
private static final String CREATE_ROSTER = "INSERT INTO OFROSTER (ROSTERID, USERNAME, JID, SUB, ASK, RECV, NICK) VALUES (?, ?, ?, 3, -1, -1, ?)";
private static final String CLUSTER = "@cluster.ee.com";
public static final int TOTAL_TEST_NUM = 10;
// 负载均衡服务器端口
public static final int PORT_NUM = 15222;
// 创建好友关系ROSTER的sql
private static final String PAN_USER = "panuser";
static Connection getConnection() throws ClassNotFoundException, SQLException {
// 加载db2的驱动类
Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection conn = DriverManager.getConnection(DB_CONNECT_URL, DB_USER, DB_PASSWORD);
return conn;
}
public static void creatRosterImpl(int rosterId, String username, String cluster, String nick)
throws SQLException, ClassNotFoundException {
Connection con = null;
PreparedStatement pstmt = null;
con = getConnection();
pstmt = con.prepareStatement(CREATE_ROSTER);
pstmt.setInt(1, rosterId);
pstmt.setString(2, username);
pstmt.setString(3, cluster);
pstmt.setString(4, nick);
pstmt.executeUpdate();
}
}
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class CreatOfRoster {
// get chat db properties from openfire global property API
public static final String DB_CONNECT_URL = "jdbc:db2://10.23.250.41:50000/isse2:currentSchema=cssde;";
public static final String DB_USER = "root2";
public static final String DB_PASSWORD = "root2";
// 创建好友关系ROSTER的sql
private static final String CREATE_ROSTER = "INSERT INTO OFROSTER (ROSTERID, USERNAME, JID, SUB, ASK, RECV, NICK) VALUES (?, ?, ?, 3, -1, -1, ?)";
private static final String CLUSTER = "@cluster.ee.com";
public static final int TOTAL_TEST_NUM = 10;
// 负载均衡服务器端口
public static final int PORT_NUM = 15222;
// 创建好友关系ROSTER的sql
private static final String PAN_USER = "panuser";
static Connection getConnection() throws ClassNotFoundException, SQLException {
// 加载db2的驱动类
Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection conn = DriverManager.getConnection(DB_CONNECT_URL, DB_USER, DB_PASSWORD);
return conn;
}
public static void creatRosterImpl(int rosterId, String username, String cluster, String nick)
throws SQLException, ClassNotFoundException {
Connection con = null;
PreparedStatement pstmt = null;
con = getConnection();
pstmt = con.prepareStatement(CREATE_ROSTER);
pstmt.setInt(1, rosterId);
pstmt.setString(2, username);
pstmt.setString(3, cluster);
pstmt.setString(4, nick);
pstmt.executeUpdate();
}
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询