Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java Application Ö±½Óͨ¹ýjndiÁ¬½ÓÊý¾Ý¿â

À´Ô´£ºhttp://www.ej38.com/showinfo/java-132636.html
ʹÓÃjar°ü:
 commons-pool-1.5.3.jar,tomcat-naming-common.jar,commons-pool-1.5.3-bin.zip,commons-dbcp.jar
 ×¢Òâ:jdbc Çý¶¯ÒªÓëÊý¾Ý¿â¼æÈÝ.
 package test.comm;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
public class DBConnector {
static private InitialContext ic = null;
static private DataSource ds = null;

static private void initContext(){
try {

BasicDataSource bds = new BasicDataSource();
bds.setUrl("jdbc:oracle:thin:@localhost:1521:test");
bds.setDriverClassName("oracle.jdbc.OracleDriver");
bds.setUsername("test");
bds.setPassword("a");

Hashtable<String, String> evn = new Hashtable<String,String>();
evn.put("java.naming.factory.initial","org.apache.naming.java.javaURLContextFactory");
ic = new InitialContext(evn);
ic.bind("mydatasource", bds);
ds = (DataSource) ic.lookup("mydatasource");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

static public Connection getConn() throws SQLException{
if (ds == null){
initContext();
}
return ds.getConnection();
}


}

²âÊÔ:
package test;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import test.comm.DBConnector;
public class wfTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Connection conn = DBConnector.getConn();
System.out.println("conn = "+conn);
String qSQL = "SELECT USERNAME,LOGINID from S_U_USER";
Statement stmt = conn.createStatement();


Ïà¹ØÎĵµ£º

JavaÄÚ´æ¹ÜÀí(¶þ¡¢JavaÀ¬»ø»ØÊÕ)

¶þ¡¢JavaÀ¬»ø»ØÊÕ
1. JVMÔËÐл·¾³ÖÐÀ¬»ø¶ÔÏóµÄ¶¨Òå
     Ò»¸ö¶ÔÏó´´½¨ºó±»·ÅÖÃÔÚJVMµÄ¶ÑÄÚ´æÖУ¬µ±ÓÀÔ¶²»ÔÙÒýÓÃÕâ¸ö¶ÔÏóʱ£¬Ëü½«±»JVMÔÚ¶ÑÄÚ´æÖлØÊÕ¡£»ò  µ±¶ÔÏóÔÚJVMÔËÐпռäÖÐÎÞ·¨Í¨¹ý¸ù¼¯ºÏ(root set)µ½´ïʱ£¬Õâ¸ö¶ÔÏó¾Í±»³ÆΪÀ¬»ø¶ÔÏó¡£
2. ¶ÑÄÚ´æ
* ÔÚJVMÆô¶¯Ê±±»´´½¨£»¶ÑÄÚ´æÖÐËù´æ´¢µ ......

Çø±ðjavaµÄ C++ÄÚ´æ·ÖÅä ֪ʶ,È«¾Ö£¬¾Ö²¿£¬¾²Ì¬±äÁ¿


Ô¤±¸ÖªÊ¶—³ÌÐòµÄÄÚ´æ·ÖÅä 
Ò»¸öÓÉC/C++±àÒëµÄ³ÌÐòÕ¼ÓõÄÄÚ´æ·ÖΪÒÔϼ¸¸ö²¿·Ö 
1¡¢Õ»Çø£¨stack£©— ÓɱàÒëÆ÷×Ô¶¯·ÖÅäÊÍ·Å £¬´æ·Åº¯ÊýµÄ²ÎÊýÖµ£¬¾Ö²¿±äÁ¿µÄÖµµÈ¡£Æä²Ù×÷·½Ê½ÀàËÆÓÚÊý¾Ý½á¹¹ÖеÄÕ»¡£ 
2¡¢¶ÑÇø£¨heap£© — Ò»°ãÓɳÌÐòÔ±·ÖÅäÊÍ·Å£¬ Èô³ÌÐòÔ±²»ÊÍ·Å£¬³ÌÐò½áÊøʱ¿ÉÄÜÓÉOS»ØÊÕ ......

JavaÕýÔò±í´ïʽ(×ܽáÒ»)

1.ÕýÔò±í´ïʽ½á¹¹¼ò½é£º
С֪ʶ£º{}¡¡¶¨ÒåÁËÒ»¸ö·¶Î§¡¡ [] ¶¨ÒåÁËÒ»¸ö×Ö·ûÀà¡¡() ¶¨ÒåÁËÒ»¸ö×é
*Ç°Ãæ³öÏÖ0´ÎÒÔÉÏ   +¡¡Ç°ÃæÆ¥ÅäÒ»´ÎÒÔÉÏ¡¡?Ç°Ãæ³öÏÖ0´Î»òÒ»´Î
1).×Ö·û£º
x------×Ö·ûx
\\-----·´Ð±¸Ü
\0n----Ê®½øÖÆÊý (0 <= n <= 7)
\0nn---Ê®½øÖÆÊý0nn (0 <= n <= 7)
\0mnn--Ê®½øÖÆÊý ......

Java ÖÐÁ½ÖÖftp²Ù×÷·½Ê½

×î½ü¿´µ½¼¸Æª¹ØÓÚjavaÖвÙ×÷ftpµÄÎÄÕ£¬ËùÒÔÏëдһ¸ö×ܽáÌù£¬±ê¼Çһϣ¬·½±ãÒÔºóÓ¦Óá£
Ê×ÏÈ£¬ÎÒÃÇ¿ÉÒÔÓ¦ÓÃjavaÖеÄftp¿â£¬javaÖÐÌṩÁËÒ»¸öftpclientµÄÀ࣬ÌṩÁ˺ܶà²Ù×÷ftpµÄ·½·¨¡£
ÏÈÉÏ´úÂ룬һ¿´±ãÖª£¬ºÜ¼òµ¥£¬Ó¦ÓÃʱֻҪ´«µÝÏàÓ¦µÄserver£¬user£¬passwordµÈ¾ÍÐÐÁË¡£
import java.io.IOException;
import sun.net. ......

Google Maps API in Java ME

Here is a simple library to query Google Maps with the following features:
geocode addresses to their geographic coordinates
retrieve static images with given custom size, format and zoom
To see a live sample of this API, you can check here: Java ME Google Maps API sample MIDlet
Contents
[h ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ