oracleµ÷ÓÃjava·½·¨µÄÀý×Ó
ÔÚoracleÖе÷ÓÃjava³ÌÐò,×¢Òâ:java·½·¨±ØÐëÊÇstaticÀàÐ͵Ä,Èç¹ûÏëÔÚJAVAÖÐʹÓÃsystem.out/errÊä³ölog.
ÐèÒªÔÚoracle ÖÐÖ´ÐÐ"call dbms_java.set_output(5000);".
Ò»¡¢helloWord
1 ±àдJAVA³ÌÐò,Ò²ÊÇÔÚSQL/PLUSÖÐд,²¢Ö´ÐÐ.
create or replace and compile java source named hello as
public class Hello {
static public String Message(String name) {
return " Hello, " + name;
}
}
/
2 ·¢²¼JAVA³ÌÐò
create or replace function hello (name VARCHAR2 ) return VARCHAR2
as language java name
' Hello.Message (java.lang.String) return java.lang.String ' ;
/
3 ʹÓ÷¢ÃæµÄJAVA³ÌÐò
select hello( ' world! ' ) from dual;
HELLO( ' world! ' )
-- -------------
Hello world!
¶þ¡¢ÔÚJAVA³ÌÐòÖÐʹÓÃSQL
1 ±àдJAVA³ÌÐò
create or replace and compile java source named test as
import java.sql. * ;
import java. text .DateFormat;
import java. text .SimpleDateFormat;
import java.util. * ;
import java.util.Date;
import com.ccit.wcsmp.comm.vo.daovo.MBTResultVO;
import oracle.sql.ARRAY;
import oracle.sql.ArrayDescriptor;
public class Test
{
static public String message(String name) {
String sql = " select sysdate as dd from dual";
String tmpStr = null ;
PreparedStatement pstmt = null ;
ResultSet rs = null ;
Connection conn = null ;
try
 
Ïà¹ØÎĵµ£º
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
ÔÚÕâÀï½éÉÜÁ½ÖÖ·½·¨Éú³Éjar£¬µÚÒ»ÖÖÊÇÓÃEclpiseµÄExport¹¦ÄÜ¡£ÔÚÒª´ò°üµÄÏîÄ¿ÉÏ»÷ÓÒ¼ü£¬Ñ¡ÔñExport£¬ÔÚ´°¿ÚÖÐÑ¡ÔñJavaÀïµÄJAR file¡£NextºóµÄ´°¿ÚÖÐÒѾ×Ô¶¯Ñ¡ºÃÁËÒª´ò°üµÄÏîÄ¿£¬Óû§¿ÉÒÔµã»÷¼ÓºÅ²é¿´ÏîÄ¿Àï±»´ò°üµÄÄÚÈÝ¡£ÔÚÏÂÃæµÄJAR fileÀïÉèÖÃÄã´ò°üÉú³ÉjarÎļþµÄÊä³öĿ¼£¬ÏÂÒ»²½ÔÚ³öÏֵĴ°¿ÚÖÐÑ¡ÔñUse existin ......
תÌù×Ô http://www.3800hk.com/Article/cxsj/java/jcjcjave/2009-11-10/Article_181759.html
¡¡1. Õ»(stack)Óë¶Ñ(heap)¶¼ÊÇJavaÓÃÀ´ÔÚRamÖдæ·ÅÊý¾Ý
µÄµØ·½¡£ÓëC++²»Í¬£¬Java×Ô¶¯
ÖÎÀíÕ»ºÍ¶Ñ£¬³ÌÐòÔ±²»ÄÜÖ±½ÓµØÉèÖÃÕ»»ò¶Ñ¡£
¡¡¡¡
¡¡¡¡2. Õ»µÄÓÅÊÆÊÇ£¬´æÈ¡ËٶȱȶÑÒª¿ì£¬½ö´ÎÓÚÖ±½ÓλÓÚCPUÖеļĴæÆ÷¡£µ«È±µãÊÇ£¬ ......
javaµ÷ÓÃÍⲿ³ÌÐò ±ØÉ± ·¾¶¿Õ¸ñûÓÐÎÊÌâ
Runtime rt = Runtime.getRuntime();
srcFile.getName();
try {
String cmd[]={"cmd","/c",srcFile.getAbsolutePath()};
rt.exec(cmd);
} catch (IOException e1) {
// TODO Auto-genera ......
²»ÌᳫʹÓõķ½·¨ÊÇΪ֧³ÖÏòºó¼æÈÝÐÔ¶ø±£ÁôµÄÄÇЩ·½·¨£¬ËüÃÇÔÚÒÔºóµÄ°æ±¾ÖпÉÄܳöÏÖ£¬Ò²¿ÉÄܲ»³öÏÖ¡£Java ¶àÏß³ÌÖ§³ÖÔÚ°æ±¾ 1.1 ºÍ°æ±¾ 1.2 ÖÐ×öÁËÖØ´óÐÞ¶©£¬stop()¡¢suspend() ºÍ resume() º¯ÊýÒѲ»ÌᳫʹÓá£ÕâЩº¯ÊýÔÚ JVM ÖпÉÄÜÒýÈë΢ÃîµÄ´íÎó¡£ËäÈ»º¯ÊýÃû¿ÉÄÜÌýÆðÀ´ºÜÓÕÈË£¬µ«ÇëµÖÖÆÓÕ»ó²»ÒªÊ¹ÓÃËüÃÇ¡£
µ÷ÊÔÏ̻߳¯µÄ ......