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
}
Ïà¹ØÎĵµ£º
Ö±½Óͨ¹ýmainÈë¿Ú:
argumentsÉèÖãº-Djava.library.path=¶¯Ì¬¿âËùÔÚĿ¼
ÔÚLinuxÉϵ÷.soÎļþ£º.soÎļþ ±ØÐëÃüÃûΪ£ºlibXXX.so,È磺libJni.so
ÔÚWindowsÉϵ÷.dllÎļþ£º.dllÎļþ ÃüÃû²»Òª¼Ólib,Ö±½ÓÃüÃûΪ£ºXXX.dll È磺Jni.dll
Àý£º
¶¯Ì¬¿â£ºlibJniNassirDecrypt.so »ò JniNassirDecrypt.dll
javaµ÷Óö¯Ì¬¿â´úÂë:
Str ......
±àдһ¸ö³ÌÐò£¬ÅжÏÒ»¸ö×Ö·û´®ÊÇ·ñÊǺϷ¨µÄJava±êʶ·û£»
//create string
import java.util.regex.*;
public class Split {
public static void main (String[] args) {
Pattern pattern = Pattern.compile("[,]");
String[] arrStr = pattern.split("abstract,break,byte,boole ......
Java´úÂë
import java.util.Timer;
import java.util.TimerTask;
import java.util.Timer;
import java.util.TimerTask;
Java´úÂë
public class Test {
public static void main(String[] args) { ......
ÎÒ×°µÄÊÇXpϵͳ£¬µ±ÎÒ×°Sql Server2000Êý¾Ý¿âºó£¬ÓÃJava³ÌÐòÀ´½øÐÐÊý¾Ý¿âÁ¬½Óʱ³ö´íÁË£¬·¢ÏÖÊÇ1433¶Ë¿ÚûÓдò¿ª£¬ÔÚÍøÉÏÕÒÁËЩ½â¾ö°ì·¨£¬·½·¨ËµµÄ²»ÊǺÜÇå³þ£¬»¹ÓеãÂÞàÂÁË¡£ÎÒ½â¾öºó·¢ÏÖ°ì·¨ÊÇ£ºÊ×ÏÈÊDz鿴ÄãµÄ°æ±¾£¬¿ÉÒÔÓÃselect @@versionÀ´²é¿´¡£×°ÍêSql Server 2000 1433¶Ë¿ÚÓÐÊÇûÓдò¿ª£¬¿ÉÒÔÓÃnet -an -p tcp ......
1 ËùÓÐµÄ .java|.jsp|.html|.xml Ô´Îļþ¾ùʹÓÃutf-8±àÂë¸ñʽ±£´æµ½ÏµÍ³´ÅÅÌ¡£
È磺ÔÚEclipseÖбà¼Îļþ£¬Ñ¡ÖÐÎļþ´ò¿ªÓÒ¼ü²Ëµ¥Ñ¡ÔñÊôÐÔ£¬½«Îı¾Îļþ±àÂëÉèÖÃΪÆäËû²¢Ñ¡ÔñUTF-8£»Ò²¿ÉÒÔÔÚ
Eclipse——Ê×Ñ¡Ïî——³£¹æ——ÄÚÈÝÀàÐÍÖÐÉèÖø÷ÖÖÎļþµÄȱʡ±àÂ룬ÕâÑùÒÔºóËùÓеÄÎı¾Îļþ¶¼Ê¹ÓÃÍ³Ò ......