ÔÚjavaÖÐÓÃÊý¾Ý¿âÁ¬½Ó³ØÁ¬½ÓÊý¾Ý¿â
ºÃ¶à´óÐ͵ÄÆóÒµÏîÄ¿¶¼ÒªÓõ½¸ß¼¶JDBCÁ¬½ÓÊý¾Ý¿âÅäÖø߼¶JDBCʵÀýÈçÏ£º
µÚÒ»£ºÅäÖÃTomcatϵÄconfÎļþ¼ÐϵÄcontext.xmlÎļþ
<?xml version='1.0' encoding='utf-8'?>
<Context>
<Resource name="jdbc/Ãû³Æ" auth="Container" type="javax.sql.DataSource"
maxActive="10" maxIdle="5" maxwait="-1" username="sa" password="1234"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://localhost:1433;Databasename=books" />
</Context>
¸÷ÊôÐÔ˵Ã÷
<?xml version='°æ±¾' encoding='±àÂ뷽ʽ'?>
<Context>//ÉÏÏÂÎÄ
name=Êý¾ÝÔ´Ãû³Æ auth-¹ÜÀíÕß=Container»òAppliction type=Êý¾ÝÔ´ÀàÐÍ maxActive=×î´óÁ¬½ÓÊý macIdle=×îСÁ¬½ÓÊý maxwait=Á¬½ÓµÈ´ýʱ¼ä username=Êý¾Ý¿âÓû§Ãû password=Êý¾Ý¿âÁ¬½ÓÃÜÂë driverClassName=Çý¶¯Ãû³Æ url=Çý¶¯Á¬½ÓÀàÐÍdatabaseName=Êý¾Ý¿âÃû³Æ
</Context>
µÚ¶þ£ºÅäÖÃÏîĿϵÄWebRootĿ¼ÏµÄweb—infĿ¼ÏµÄweb.xmlÎļþ
<resource-ref>
<description>˵Ã÷Îĵµ</description>
<res-ref-name>Êý¾ÝÔ´Ãû³Æ<res-ref-name/>
<res-type>Êý¾ÝÔ´ÀàÐÍ</res-type>
<res-auth>¹ÜÀíÕßÀàÐÍ</res-auth>
</resource-ref>
µÚÈý£ºÅäÖÃÏîĿϵÄBaseDaoÁ¬½ÓÀà
Context context=new initialContext(); //³õʼ»¯
DataSource ds=(Datasource)context.lookup("java:comp/env/Êý¾ÝÔ´Ãû³Æ"); //ǰ׺+Çý¶¯Ãû³Æ
Connection conn=ds.getConnection(); //»ñµÃÁ¬½Ó
Ïà¹ØÎĵµ£º
ÒªÏëѧºÃJava£¬Ê×ÏÈÒªÖªµÀJavaµÄ´óÖ·ÖÀà¡£ÎÒÃÇÖªµÀ£¬×Ô´ÓSunÍƳöJavaÒÔÀ´£¬¾ÍÁ¦Í¼Ê¹Ö®ÎÞËù²»°ü£¬ËùÒÔJava·¢Õ¹µ½ÏÖÔÚ£¬°´Ó¦ÓÃÀ´·ÖÖ÷Òª ·ÖΪÈý´ó¿é£ºJ2SE,J2MEºÍ J2EE,ÕâÒ²¾ÍÊÇSun ONE(Open Net Environment)Ìåϵ¡£J2SE¾ÍÊÇJava2µÄ±ê×¼°æ£¬Ö÷ÒªÓÃÓÚ×ÀÃæÓ¦ÓÃÈí¼þµÄ±à³Ì£»J2MEÖ÷ÒªÓ¦ÓÃÓÚǶÈëÊÇϵͳ¿ª·¢£¬ÈçÊÖ»úºÍPDAµÄ±à ³Ì£» ......
ÍøÉÏJAVAµ÷ÓÃDLLµÄÎÄÕ²»ÉÙÁË£¬µ«·¢ÏÖÓÐЩ»¹ÊÇÓÐÎÊÌâ¡£¸ÕºÃÑо¿ÁËһϣ¬ÉÔ×ö¸ü¸Äºó£¬ÔÚVC2005ÉϲâÊÔͨ¹ý£¬£¨ReleaseºÍDebug°æ±¾¾ù¿É£©¡£
¸ü¸Äµã£º
1¡¢#include "jni.h"
2¡¢½«jni_md.hÖеģº#define JNICALL __stdcall±äΪ£º#define JNICALL __cdecl (º¯ÊýʹÓõÄÓ¦¸ÃÊÇcÓïÑÔµÄȱʡµ÷Ó÷½Ê½_cdecl·½Ê½£¬·ñÔòDLLÀ ......
±¾ÎÄÀ´×ÔºÍÄãÔÚÒ»ÆðµÄ²©¿Í£¬ÔÎıêÌ⣺¡¶JVMµ÷ÓÅ×ܽá(¶þ)-һЩ¸ÅÄî¡·¡£±¾ÎÄ×ܽáÁËJVM¸ÅÄîÖеÄJava¶ÔÏóµÄ´óС£¬ÒÔ¼°ÈýÖÖÒýÓÃÀàÐ͵Ķ¨ÒåÓëÇø·Ö¡£ »ù±¾Êý¾ÝµÄÀàÐ͵ĴóСÊǹ̶¨µÄ£¬ÕâÀï¾Í²»¶à˵ÁË¡£¶ÔÓÚ·Ç»ù±¾ÀàÐ͵ÄJava¶ÔÏó£¬Æä´óС¾ÍÖµµÃÉÌȶ¡£ ÔÚJavaÖУ¬Ò»¸ö¿ÕObject¶ÔÏóµÄ´óСÊÇ8byte£¬Õâ¸ö´óСֻÊDZ£´æ¶ÑÖÐÒ»¸öûÓÐÈÎ ......
Õâ¸öÎÊÌâÔÚÓÚ ÔÚFrameÖÐÌí¼Ó×é¼þʱ£¬Ã¿¸ö×é¼þÏÈÉ趨ÁËλÖ㬵«ÊÇÌí¼Óµ½FrameÖкóʼÖÕ»á³öÏÖÎÊÌâ¡£
ÀýÈ磺
class MyGame extends Frame
{
MyGame()
{
Label c[] = new Label[8];
for(i = 0; i<8; i++)
{
c[i] = new Lab ......
×î½üѧϰjavaµÄIO²Ù×÷£¬ÏÖÕûÀíÈçÏÂ
1 ÊäÈëÊä³ö
javaµÄ¿â½«³ÌÐòÓëÊäÈëÓйصÄÀ඼´ÓInputStream¼Ì³Ð£¬ÓëÊä³öÓйصÄÀ඼´ÓOutStream¼Ì³Ð¡£
ÒÔǰûÓÐÕÆÎÕµÄÏà¹ØÀà SequenceInputStream ½«Á½¸ö»ò¸ü¶àµÄinputStream ת»»³Éµ¥¸ö¶ÔÏóʹÓá£
2 ÔöÌíÊôÐÔºÍÓÐÓõĽӿÚ
×°ÊÎÆ÷ £º ÀûÓòã´Î»¯¶ÔÏó¶¯Ì¬Í¸Ã÷ ......