javaÊý¾Ý¿âÁ¬½Ó¼°²âÊÔ(sqlserver)
package com.test.util;
import java.sql.*;
public class ConnectDB {
private Connection conn=null;
private PreparedStatement pt=null;
private ResultSet rs=null;
private String uname="sa";
private String upwd="sa";
private String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=vsktest";
public Connection getConnection() throws Exception{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
conn=DriverManager.getConnection(url, uname, upwd);
return conn;
}
public void closeDB() throws Exception{
if(rs!=null){
rs.close();
}
if(pt!=null){
pt.close();
}
if(conn!=null){
conn.close();
}
}
public static void main(String[] args) throws Exception {
Connection conn=new ConnectDB().getConnection();
PreparedStatement pt=conn.prepareStatement("select * from test");
ResultSet rs=pt.executeQuery();
while(rs.next())
{
System.out.println(rs.getString("testname"));
}
}//end main
}
Ïà¹ØÎĵµ£º
1 ËùÓÐµÄ .java|.jsp|.html|.xml Ô´Îļþ¾ùʹÓÃutf-8±àÂë¸ñʽ±£´æµ½ÏµÍ³´ÅÅÌ¡£
È磺ÔÚEclipseÖбà¼Îļþ£¬Ñ¡ÖÐÎļþ´ò¿ªÓÒ¼ü²Ëµ¥Ñ¡ÔñÊôÐÔ£¬½«Îı¾Îļþ±àÂëÉèÖÃΪÆäËû²¢Ñ¡ÔñUTF-8£»Ò²¿ÉÒÔÔÚ
Eclipse——Ê×Ñ¡Ïî——³£¹æ——ÄÚÈÝÀàÐÍÖÐÉèÖø÷ÖÖÎļþµÄȱʡ±àÂ룬ÕâÑùÒÔºóËùÓеÄÎı¾Îļþ¶¼Ê¹ÓÃÍ³Ò ......
import java.util.ArrayList;
import java.util.List;
public class FenYe
{
static double allpage=0; //×ÜÒ³Êý
static double currpage=0; //µ±Ç°Ò³
static double pagesize=10; //ÏÔʾÐÐ
static int sta ......
/**
* »ñÈ¡·þÎñÆ÷µÄwebµØÖ·
* @return
*/
private String getWebPath(){
String _tempStr = Thread.currentThread().getContextClassLoader().getResource("").toString();
_tempStr=_tempStr.substring ......
javaÈëÃÅ
Ò»¡¢javaÊÇʲô
javaÊÇÒ»ÖÖ¼ÆËã»ú±à³ÌÓïÑÔ£¬Èí¼þ¿ª·¢Æ½Ì¨£¬Èí¼þÔËÐÐƽ̨£¬»¹ÊÇÒ»ÖÖÈí¼þ²¿Êð»·¾³¡£
¶þ¡¢javaÓÐʲô
java¼¼ÊõÓÐÈý¸ö·ÖÖ§£ºJava SE¡¢Java EEºÍJava ME¡£
Èý¡¢javaÄܸÉʲô
Ö÷ÒªÓÐÈý¸ö·½Ã棺×ÀÃæÓ¦ÓóÌÐòµÄ¿ª·¢¡¢ÆóÒµ¼¶µÄÓ¦ÓúÍǶÈëʽÉ豸¡£
ËÄ¡¢javaµÄÌصã
javaÊÇÒ»ÖÖ¼òµ¥µÄ¡¢ÃæÏò¶ÔÏóµÄ¡¢·Ö² ......
×î½üÏîÄ¿ÖÐÓÐÐèÒªÓõ½¹É¼Û£¬ÓÚÊÇÔÚÍøÉÏÕÒÁËÒ»·¬£¬Ã»ÓÐÒ»¸öÖ±½Ó¾ÍÄÜÓõġ£×Ô¼ºÃþË÷ÁËһϣ¬ÖÕÓڸ㶨һ¸ö¹Ë´ó¼Ò²Î¿¼¡£
package test;
import java.util.Arrays;
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
/**
*
* ¹¦ÄܸÅÊö£º<br>
* ......