//建立连接,localhost为主机名,dba为用户名,sql为密码 connection myconn = drivermanager.getconnection("jdbc:sybase:tds:localhost:2638","dba","sql"); statement mystmt = myconn.createstatement(); //执行查询 resultset myresults = mystmt.executequery(querystring); myjdbctest.displayresults(myresults); //关闭所有打开的JDBC连接Sybase资源 myresults.close(); mystmt.close(); myconn.close(); } } |