ÈçºÎÔÚOracleÖÐʹÓÃJava´æ´¢¹ý³Ì (Ïê½â)
Æäʵ£¬Õâƪ¶ÌÎÄ£¬ÎÒÔç¾ÍÓ¦¸ÃдÁË¡£ÒòΪ£¬java´æ´¢¹ý³Ì½ñºóÔÚ¸÷´óÊý¾Ý¿â³§ÉÌÖÐÔ½À´Ô½Á÷ÐУ¬¹¦ÄÜÒ²Ô½À´Ô½Ç¿´ó¡£ÕâÀïÒÔOracleΪÀý£¬½éÉÜÒ»ÏÂjava´æ´¢¹ý³ÌµÄ¾ßÌåÓ÷¨¡£
Ò»¡¢ÈçºÎ´´½¨java´æ´¢¹ý³Ì£¿
ͨ³£ÓÐÈýÖÖ·½·¨À´´´½¨java´æ´¢¹ý³Ì¡£
1. ʹÓÃoracleµÄsqlÓï¾äÀ´´´½¨£º
e.g. ʹÓÃcreate or replace and compile java source named "<name>" as
ºó±ß¸úÉÏjavaÔ´³ÌÐò¡£ÒªÇóÀàµÄ·½·¨±ØÐëÊÇpublic staticµÄ£¬²ÅÄÜÓÃÓÚ´æ´¢¹ý³Ì¡£
SQL> create or replace and compile java source named "javademo1"
2 as
3 import java.sql.*;
4 public class JavaDemo1
5 {
6 public static void main(String[] argv)
7 {
8 System.out.println("hello, java demo1");
9 }
10 }
11 /
Java ÒÑ´´½¨¡£
SQL> show errors java source "javademo1"
ûÓдíÎó¡£
SQL> create or replace procedure javademo1
2 as
3 language java name 'JavaDemo1.main(java.lang.String[])';
4 /
¹ý³ÌÒÑ´´½¨¡£
SQL> set serveroutput on
SQL> call javademo1();
µ÷ÓÃÍê³É¡£
SQL> call dbms_java.set_output(5000);
µ÷ÓÃÍê³É¡£
SQL> call javademo1();
hello, java demo1
µ÷ÓÃÍê³É¡£
SQL> call javademo1();
hello, java demo1
µ÷ÓÃÍê³É¡£
2. ʹÓÃÍⲿclassÎļþÀ´×°ÔØ´´½¨
e.g. ÕâÀï¼ÈÈ»Óõ½ÁËÍⲿÎļþ£¬±ØȻҪ½«classÎļþ·Åµ½oracle ServerµÄijһĿ¼Ï±ߡ£
public class OracleJavaProc
{
public static void main(String[] argv)
{
System.out.println("It's a Java Oracle procedure.");
}
}
SQL> grant create any directory to scott;
ÊÚȨ³É¹¦¡£
SQL> conn scott/tiger@iihero.oracledb
ÒÑÁ¬½Ó¡£
SQL> create or replace directory test_dir as 'd:\oracle';
Ŀ¼ÒÑ´´½¨¡£
SQL> create or replace java class using bfile(test_dir, 'OracleJavaProc.CLASS')
2 /
Java ÒÑ´´½¨¡£
SQL> crea
Ïà¹ØÎĵµ£º
µ±Ò»¸ö¸´ÔӵĶÔÏó±»¹¹Ôìʱ,ËüµÄ¹¹Ô캯Êý°´ÏÂÃæµÄ˳Ðò±»µ÷ÓÃ(that the order of constructor calls for a complex object is as follows)
1.Æä»ùÀà(base-class)µÄ¹¹Ô캯Êý±»µ÷ÓÃ,Õâ¸ö²½ÖèÒԵݹéµÄ·½Ê½Öظ´,ËùÒÔ×îµ×²ã(the root of hierarchy)µÄ¹¹Ô캯ÊýÊ×Ïȱ»Ö´ÐÐ,È»ºóÊÇËüÉÏÒ»²ãÅÉÉúÀà(the next-deriv ......
¹úÍâjavaÍøÕ¾´óÈ«
http://www.javaalmanac.com- Java¿ª·¢ÕßÄê¼øÒ»ÊéµÄÔÚÏß°æ±¾. ÒªÏë¿ìËٲ鵽ijÖÖJava¼¼ÇɵÄÓ÷¨¼°Ê¾Àý´úÂë, ÕâÊÇÒ»¸ö²»´íµÄÈ¥´¦.
http://www.onjava.com - O'ReillyµÄJavaÍøÕ¾. ÿÖܶ¼ÓÐÐÂÎÄÕÂ.
http://java.sun.com - ¹Ù·½µÄJava¿ª·¢ÕßÍøÕ¾ - ÿÖܶ¼ÓÐÐÂÎÄÕ·¢±í.
http://www.developer.com/java - ......
JAVA String¶ÔÏóºÍ×Ö·û´®³£Á¿µÄ¹Øϵ½âÎö
1 ×Ö·û´®ÄÚ²¿Áбí
JAVAÖÐËùÓеĶÔÏ󶼴æ·ÅÔÚ¶ÑÀïÃ棬°üÀ¨String¶ÔÏó¡£×Ö·û´®³£Á¿±£´æÔÚJAVAµÄ.classÎļþµÄ³£Á¿³ØÖУ¬ÔÚ±àÒëÆÚ¾ÍÈ·¶¨ºÃÁË¡£
ÐéÄâ»úΪÿ¸ö±»×°ÔصÄÀàÐÍά»¤Ò»¸ö³£Á¿³Ø¡£³£Á¿³Ø¾ÍÊǸÃÀàÐÍËùÓó£Á¿µÄÒ»¸öÓÐÐò¼¯ºÏ£¬°üÀ¨Ö±½Ó³£Á¿(string¡¢integerºÍfloat point³ ......
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.zip.CRC32;
public static void main(String[] args){
& ......
Òì³£ Underlying input stream returned zero bytes ½â¾ö°ì·¨
ϵͳ»·¾³
jdk1.5
hibernate 3.0
sql server 2000
ms jdbc driver
½«Ò»¸övarcharÀàÐ͵Ä×ֶθÄΪtextºó£¬¾Í³öÏÖ
[Microsoft][SQLServer 2000 Driver for JDBC]Underlying input stream returned zero bytes µÄÒì³£ÁË¡£
´ÓÍøÉÏËѼ¯×ÊÁÏÀ´¿´£¬ÓÉÓÚjdbcµÄbug ......