ÔÚOracleÏ¿ª·¢Java³ÌÐòµÄ¾µäÎÊÌâ½â´ð
ÎÊÌâÒ»£ºÈç±£¼ÓÔØJDBCÇý¶¯³ÌÐò£º
Õý³£ÎÒÃǼÓÔØÇý¶¯³ÌÐòÓÐÈý¸ö;¾¶£º
1.Class.forName(String)ÕâÏëµ±ÓÚclassLoaderÒ»¸öStringÖ¸¶¨µÄÀ࣬ÔÚ×°ÔØʱ°Ñ¸ÃÇý¶¯³ÌÐòµÄ¾²Ì¬ÄÚÈݶ¼³õʼ»¯£¬ÆäʵÕâʱÇý¶¯³ÌÐòÀàµ÷ÓÃÁËDriverManager.registerDriver(driver)·½·¨¡£
2.ʹÓÃϵͳÊôÐÔ£ºSystem.getProperty().load(new FileInputStream("ÊôÐÔÎļþ"));
ÔÚÊôÐÔÎļþÖÐÖ¸¶¨jdbc.driver=drivername ÕâÑùµÄºÃ´¦ÊÇ¿ÉÒÔͬʱ¼ÓÔضà¸öJDBC£¬»»Êý¾Ý¿âʱ²»Ó÷ÃÎÊJavaÔ´´úÂ룬ֻÊÇÐÞ¸ÄÊôÐÔÎļþ¡£
3.Ö±½ÓregisterDriver(driver£©ÕâÖÖ·½·¨×î¿É¿¿£¬¿ÉÒÔÔÚÈκλ·¾³ÏÂʹÓá£
1·½·¨¼òµ¥£¬µ«MSµÄJVM²»ÄÜÕýÈ·³õʼ»¯¡£±ÈÈçʹÓÃIEʱÔÚAPPLETÖоͲ»ÄÜʹÓã¬Ó¦¸ÃÓÃ3µÄ·½·¨¡£µ«3£©·½·¨ÔÚÁé»îÐÔ·½Ãæ²»Èç2£¬¿ÉÒÔ¸ù¾Ý»·¾³×ۺϿ¼ÂÇ¡£
ÎÊÌâ¶þ£º´ó¶ÔÏó´æ´¢
Ò»°ãÀ´Ëµ£¬´ó¶ÔÏó´æ´¢ÊÇ°ÑÎļþ´æµ½Êý¾Ý¿âÖУ¬µ±È»Ò²¿ÉÒÔÄÚ´æÖеij¬´ó×Ö·û´®¡£¶ÔÓÚÏóͼƬÕâÑùµÄÎļþµ±È»ÊÇÓöþ½øÖÆ´æ´¢£¬ÕâÀïÓкܶàÎóÇø£¬ÍøÂçÉϵĽ̳Ì99%¶¼ÊÇÐв»Í¨µÄ£¬
Á¬SUN×Ô¼ºµÄÎĵµ¶¼Ò»Ö±´íÎó£¬ËäÈ»´íÎóºÜС¡£°´Ëµ¶þ½øÖÆÎļþÓ¦¸Ã´æΪBLOBÀàÐÍ£¬µ«JBDC2²¢²»ÄÜÖ±½Ó¶ÔBLOB´æÈë¶þ½øÖÆÎļþ£¬Èç¹ûÄãÕâÑù×ö£¬»áµÃµ½Ò»¸öIO¶ø²»ÊÇSQLÒì³££¬Îª´Ë
»¨ÁËÎÒ½üÁ½¸öСʱ²ÅŪÇå³þ¡£
Èç¹ûÒª°ÑÒ»¸ö¶þÖÆÎļþ´æÈëOracle£¬Óñê×¼µÄJDBCÄã¾ÍÒªÓÃLONG ROWÀàÐÍ£º
create table tb_file(name varchar(20),detail long row);
È»ºó:
File file = new File("aaa.gif");
int fileLength =(int) file.length();
InputStream fin = new FileInputStream(file);
PreparedStatement pstmt = con.prepareStatement
("insert into tb_file values(´aaa.gif´,?)");
pstmt.setBinaryStream (1, fin, fileLength);
pstmt.executeUpdate();
Èç¹ûÄãÒ»¶¨ÒªÓÃBLOB´æ´¢£¬Äã¾Í±ØÐëÓÃOracle×Ô¼ºµÄ·½·¨£º
create table tb_file(name varchar(20),detail BLOB);
con.setAutoCommit(false);
stmt.executeUpdate("insert into tb_file values
(´aaa.gif´,empty_blob())");
ÏÂÃæ±ØÐëSELECTµÃµ½BLOBµÄ¶ÔÏóÔÙÏòÀïд£º
rs = stmt.executeQuery
("select detail from tb_file
where name=´aaa.gif´
for upfdate" );
if(rs.next())
Ïà¹ØÎĵµ£º
Java¶ÔÏóXMLÐòÁл¯¿ò¼Ü£Simple2.0
SimpleÊÇÒ»¸öXMLÐòÁл¯¿ò¼Ü£¬Ò»¸öJava
°æ±¾¿íÈݵÄÐòÁл¯¿ò¼Ü£¬Äܹ»¿ìËÙÔÚJava
ƽ̨ÉÏ¿ª·¢XML¡£Ö§³Öͨ¹ýannotationsÍêÈ«ÅäÖû¯µÄXML½á¹¹£»Ìṩ°æ±¾¹ÜÀí¿ò¼ÜÔÊÐíÏòÇ°ºÍÏòºó¼æÈÝÐòÁл¯£»¸üºÃµÄÐÔÄÜ£¬Ê¹ÓÃÇáÁ¿¼¶StAXÌáÉýXML·´ÐòÁл¯
½ø³Ì£¬±ÈXStreamºÍJAXB¸ü¿ì£»Í¨¹ýnamespace ......
×Ô¼ºÔÚ×öÕâ¸ö³ÌÐòµÄʱºò¿´¹ýºÜ¶àµÄ×ÊÁÏ£¬ÉÏÍøÒ²²éÁ˲»ÉÙµÄ×ÊÁÏ£¬¿ÉÊǶà°ë˵µÄÊdzöÉñÈ뻯£¬ÔÆÀïÎíÀï...²»¹â¿´Á˲»Ã÷°×£¬¶øÇÒÊÇÓÐÃ÷°×Ò»µãµÄÈË£¬¿´ÁËÒ²±äµÄÓÐЩģºýÁË¡£
ÕâÀïÎÒÑÚÊÎÒ»Ì×ÍêÕûµÄjava jdbc Á¬½ÓOracle9iµÄ·¶Àý¡£
package com.lxh.dbcon;//´ò°ü
import ......
1. Òì³£»úÖÆ
Òì³£»úÖÆÊÇÖ¸µ±³ÌÐò³öÏÖ´íÎóºó£¬³ÌÐòÈçºÎ´¦Àí¡£¾ßÌåÀ´Ëµ£¬Òì³£»úÖÆÌṩÁ˳ÌÐòÍ˳öµÄ°²È«Í¨µÀ¡£µ±³öÏÖ´íÎóºó£¬³ÌÐòÖ´ÐеÄÁ÷³Ì·¢Éú¸Ä±ä£¬³ÌÐòµÄ¿ØÖÆȨתÒƵ½Òì³£´¦ÀíÆ÷¡£
´«Í³µÄ´¦ÀíÒì³£µÄ°ì·¨ÊÇ£¬º¯Êý·µ»ØÒ»¸öÌØÊâµÄ½á¹ûÀ´±íʾ³öÏÖÒì³££¨Í ......
ÊÖÉÏÒ»¸öÏîÄ¿ÐèҪͨ¹ýusb¿ÚÈ¥¶ÁÈ¡usbkeyµÄÐÅÏ¢£¬³§¼ÒÌṩµÄÖ»ÓÐC/C++µÄ½Ó¿Ú£¬¶øÖ÷Ó¦ÓÃÊÇjavaµÄ£¬ËùÒÔÐèҪʹÓÃjavaÈ¥µ÷Óö¯Ì¬Á´½Ó¿â£¬ËùÒÔ»¨Á˵ãʱ¼äÑо¿ÁËÏÂJNI¼¼Êõ£¬jdk¶ÔJNI¼¼Êõ·â×°µÃºÜµ½Î»£¬Ê¹ÓÃÆðÀ´·Ç³£¼òµ¥£¬JNI¼¼Êõ×î¹Ø¼ü»¹ÊÇÔÚÓÚjniÊý¾ÝÀàÐͺͱ¾µØÊý¾ÝÀàÐ͵Äת»»¡£Ïȼòµ¥ÂÞÁÐÏÂJNIµ ......