当前位置: 代码迷 >> SQL >> sql话语查询文档信息
  详细解决方案

sql话语查询文档信息

热度:32   发布时间:2016-05-05 14:09:10.0
sql语句查询文档信息
package jwis.retest;

import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import wt.doc.WTDocument;
import wt.httpgw.GatewayURL;
import wt.pds.PDSIfc;
import wt.pom.DataServicesRegistry;
import wt.pom.UnsupportedPDSException;
import wt.util.WTException;

public class SqlTest {

public static void main(String[] args) throws SQLException, WTException {

//获取URL地址
URL url = GatewayURL.getAuthenticatedGateway(null).getURL("");

System.out.println("URL="+url);

//创建数据库连接

PDSIfc pds = DataServicesRegistry.getDefault().getPdsFor("DEFAULT");

Connection conn = null;

if(pds!=null){

conn = pds.getDataSource().getConnection();

}

//sql语句

    String sql = "select name from wtdocument t , wtdocumentmaster mast where t.ida3masterreference = mast.ida2a2 and mast.wtdocumentnumber='0000000024'";

PreparedStatement ps = conn.prepareStatement(sql);

ResultSet rs = ps.executeQuery();

//WTDocument doc =null;

while(rs.next()){
System.out.println(rs.getRow());
System.out.println(rs.getString(1));
}

conn.close();
}

}
  相关解决方案