新手求domino中JDBC连接MYSQL的例子
java和mysql都不太会用,哪位大侠能帮忙给个java代理完整代码参考,谢谢相关信息如下
ipSQL : 192.168.200.5
portSQL : 3306
user : root
pwd : 123456
SQL: select * from mydb
请各路大侠一定帮帮忙,感激不尽 --------------------编程问答-------------------- ...
...
Class.forName("com.mysql.jdbc.Driver");
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String sql = "";
conn = DriverManager.getConnection("jdbc:mysql://192.168.200.5:3306/mydb","root","123456");
stmt = conn.createStatement();
sql="select * from mydb"; //<-------数据库和表的名称一样??
rs=stmt.executeQuery(sql);
stmt.close();
conn.close();
...
...
没有测试,自己试试吧,注意开始时要先引入对应版本的jdbc驱动jar包 --------------------编程问答-------------------- 我也想知道,正在找這方面的資料~~~~~ --------------------编程问答-------------------- 参考我的这个帖子http://topic.csdn.net/u/20080707/16/308e392f-fdf0-4458-966c-9d4ec2d5d524.html,不过在程序优化上还需要改进,提供参考思路。 --------------------编程问答-------------------- try {
session = getSession();
agentContext = session.getAgentContext();
docContext = agentContext.getDocumentContext();
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://10.71.48.15:3306/scweb";
conn = DriverManager.getConnection(url, "root", "12345678");
if(conn != null){
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
strbir_year = docContext.getItemValueString("FallDue");
strbir_month = docContext.getItemValueString("CaseFor");
strbir_day = docContext.getItemValueString("CaseBy");
strSQL = new StringBuffer();
strSQL.append("INSERT INTO tbl_hzsc_suggestion_ta(serialNo,contentCategory,conferenceName,reason,taPeople,committeeUnit,content,documentID) ");
strSQL.append("VALUES ('" + strbir_year + "',");
strSQL.append("'" + strbir_month + "',");
strSQL.append("'" + strname + "')");
System.out.println(strSQL.toString());
stmt.execute(strSQL.toString());
System.out.println("插入成功");
}
补充:企业软件 , Lotus