- 1、本文档共13页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
在sybase中获得建索引的语句(Get indexed in the Sybase statement)
在sybase中获得建索引的语句(Get indexed in the Sybase statement)
import java.sql.connection;
import java.sql.drivermanager;
import java.sql.preparedstatement;
import java.sql.resultset;
import java.util.arraylist;
import java.util.list;
public class test {
private string name = ;
private string indname = ;
private string id = ;
private string keys = ;
private string keys2 = ;
private int keycnt = 0;
private int status = 0;
/ * *
* 获取数据库连结
*
* @ return
* @ throws exception
* /
public static connection getconnection () {
connection con = null;
try {
class.forname (com.sybase.jdbc2.jdbc.sybdriver).newinstance ();
string url = sybase数据库连接;
string drivers = com.sybase.jdbc2.jdbc.sybdriver;
if (drivers! = 0) {
system.setproperty (jdbc.drivers, drivers);
}
string username = 用户名;
string password = 密码;
con = drivermanager.getconnection (url, username,
password);
return con.
} catch (exception e) {
e.printstacktrace ();
}
return con.
}
public static void main (string [] args) throws exception {
connection conn = getconnection ();
try {
string query = select o.name name, i.name indname, o.id id, i.keys1 keys1, i.keys2 keys2, i.keycnt keycnt, i.status status from sysindexes i, sysobjects o where keycnt 0 and i.id = o.id and o.type = u;
preparedstatement stmt = conn.preparestatement (sql);
resultset rs = stmt.executequery ();
list list = new arraylist test (test);
while (rs.next ()) {
test t = new test ();
t.setname (rs.getstring (name);
t.setindname (rs.getstring (indname));
t.setid (rs.getstring (id));
t.setkeys (rs.getstring (keys1));
t.setkeys2 (rs.getstring (keys2));
t.setkeycnt (rs.getint (keycnt));
t.setstatus (rs.getint (status));
list.add (t).
}
for (int i = 0; i list.size (); i + +) {
test t = list.get (i);
/ / system.out.println (表 + t.getid () + 表名 + t.getname () +
/ / 索引名
/ / + t.
GetIndName () + column number + t.getKeycnt () + column value
T.getKeys (+ +) / column value
/ / t.getKeys2 (+));
String key = t.getKeys ();
String key2 = t.getKeys2 ();
Int count = t.getKeycnt
您可能关注的文档
- 它激式电源盒维修(The flyback power supply box maintenance).doc
- 宁波市高层民用建筑设计防火自审专篇(Ningbo city fire protection design of high-rise buildings from the special articles).doc
- 安全员考试(Exam security officer).doc
- 安全教案(Safety plan).doc
- 安全条件论证(Safe condition argument).doc
- 宁夏回族自治区2010年初中毕业暨高中阶段招生(The Ningxia Hui Autonomous Region in 2010 and graduated from junior high school senior high school students).doc
- 安全气囊系统(The airbag system).doc
- 安全导向(Safety Guide).doc
- 安全玻璃(Safety glass).doc
- 安全气囊系统的检修(The maintenance of the airbag system).doc
文档评论(0)