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

MyeclipseÖÐÁ¬½ÓOracleµÄ¾­µä´úÂë

 package cn.edu.bit.test;
import java.sql.*;
public class Jdbc {
 public static void main(String[] args)
 {
     try{ 
      Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
     System.out.println("×¢²á³É¹¦");    
     String URL = "jdbc:oracle:thin:localhost:1521:orcl";
      String user = "username";  //Á¬½ÓÊý¾Ý¿âµÄÓû§Ãû
      String password = "password";//Á¬½ÓÊý¾Ý¿âµÄÃÜÂë
      Connection conn = DriverManager.getConnection(URL, user, password); 
     System.out.println("Á¬½Ó³É¹¦"); 
      Statement st;
       st = conn.createStatement(); 
     ResultSet rs; 
       rs = st.executeQuery("select * from scott.project"); 
    while(rs.next()){ 
       System.out.println(rs.getString("time")); 
     } 
       }catch(Exception e)
     {     e.printStackTrace();    
    
     System.out.println("Á¬½Óʧ°Ü");    
   } 
      } 
}


Ïà¹ØÎĵµ£º

ʹÓÃjava + oracle²åÈëclobÀàÐ͵ÄÊý¾Ý

 Ê¹ÓÃjava + oracle²åÈëclobÀàÐ͵ÄÊý¾Ý£¬ÐèÒªÓÃÒÔϵIJ½Ö裺
1¡¢½«Êý¾Ý²åÈëÊý¾Ý¿â£¬¶ÔÓÚclob×ֶΣ¬Ê¹ÆäΪ¿ÕclobÊý¾Ý¡£ÀýÈ磺insert into test values(1,empty_clob())";
2¡¢´ÓÊý¾Ý¿âÖÐÈ¡³ö²åÈëµÄclob×ֶΣ¬²¢½«Æä¸³Öµ¸øoracle.sql.clobÀàÐ͵ıäÁ¿¡£ÀýÈç
String sqll="select content from test where id=1 for upda ......

110¸öoracle³£Óú¯Êý×ܽá(3)

 41.SYSDATE
    ÓÃÀ´µÃµ½ÏµÍ³µÄµ±Ç°ÈÕÆÚ
    SQL> select to_char(sysdate,dd-mm-yyyy day) from dual;
    TO_CHAR(SYSDATE,
  -----------------
    09-05-2004ÐÇÆÚÈÕ
    trunc(date,fmt)°´ÕÕ¸ø³öµÄÒªÇó½«ÈÕÆÚ½Ø¶Ï,È ......

ÓÃshow parameterÏÔʾOracleÒþº¬²ÎÊý

OracleÊý¾Ý¿âµÄÆô¶¯Óõ½Á˳õʼ»¯²ÎÊý£¬Ò»°ãÇé¿öÏ¿ÉÒÔÔÚsqlplusÀïÓÃshow parameter À´»ñµÃ¡£¶øOracleÊý¾Ý¿âΪÁËdebug »òÕß½â¾öÒ»Ð©ÌØÊâµÄÎÊÌ⣬»¹ÌṩÁËһЩÒÔ“_”¿ªÍ·µÄÒþº¬²ÎÊý¡£ ÍøÂçÉÏÓÐһЩscript¿ÉÒÔÈÃÎÒÃÇÇáËɼì²éÕâЩÒþº¬²ÎÊý. ÏÂÃæÎÒÃÇÀ´Ïêϸ½éÉÜÒ»ÏÂÈçºÎÖ±½ÓÔÚsqlplus ÓÃshow parameterÀ´»ñÈ¡Òþº¬²ÎÊý ......

oracle±Ê¼Ç Ö®VI JDBCÁ¬½Ó Oracle Êý¾Ý¿â

 <%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%--
 Ê¹ÓÃJDBCÁ¬½ÓOracleÊý¾Ý¿â
--%>
<%!
 String DBDRIVER="oracle.jdbc.driver.OracleDriver";
 String URL="jdbc:oracle:thin:@localhost:1521:orcl";
 String USER="scott ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ