an example to insert data into Oracle Clob
Step1. Insert empty_clob() into the Clob column of Oracle
Step2. Set autocommit to false
Step3. Select Clob as oracle.sql.CLOB from database
Step4. Insert String into Clob
Step5. Commit
Example:
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.OracleResultSet;
import oracle.sql.CLOB;
public class TestOracleClob implements Serializable{
public static void main(String[] args)
{
//create table test (id integer,content clob);
System.out.println("-------------------insert -----------------");
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con = DriverManager.getConnection ("oracle server",
"loginid", "loginpassword");
//Class.forName("oracle.jdbc.driver.OracleDriver");
con.setAutoCommit(false);
//Ok 1
String sql="insert into test values(1,empty_clob())";
Statement stmt=con.createStatement();
ResultSet
rs=stmt.executeQuery(sql);
System.out.println("-------------------insert -----------------");
String sqll="select content from test where id=1 for update";
ResultSet
rss=stmt.executeQuery(sqll);
if(rss.next()){
//CLOB clob = ((OracleResultSet)rss).getCLOB(1);
oracle.sql.CLOB clob= (oracle.sql.CLOB)rss.getClob("content");
clob.putString(1,"here is a string which contains more than 4000 character");
sql="update test set content=? where id=1";
PreparedStatement
pstmt=con.prepareStatement(sql);
pstmt.setClob(1,clob);
pstmt.executeUpdate();
pstmt.close();
}
con.commit();
//Ok 2
//String sql1="insert into test values(2,empty_clob())";
//ResultSet rs3=stmt.executeQuery(sql1);
String sql12="insert into test values(?,?)";
PreparedStatement
pstmt1=con.prepareStatement(sql12);
pstmt1.setInt(1,2);
pstmt
相关文档:
因为项目某些模块的数据结构设计没有严格按照某规范设计,所以只能从数据库中查询数据结构,需要查询的信息如下:字段名称、数据类型、是否为空、默认值、主键、外键等等。
在网上搜索了查询上述信息的方法,总结如下:
一,查询表基本信息
select
utc.column_name,utc.data_type,utc.data_le ......
About parent vs child latches. There is no fundamental low level difference between parent and child latches, they are all small regions of memory modified with atomic test-and-set style opcodes.
You see parent (and solitary) latches from x$ksll ......
第一课:客户端
1. Sql Plus(客户端),命令行直接输入:sqlplus,然后按提示输入用户名,密码。
2. 从开始程序运行:sqlplus,是图形版的sqlplus.
3. http://localhost:5560/ ......
select d.code,d.name, sum(w.weight) weight,round(avg(w.price),2) price,sum(w.money) money
from weight_info w left outer join t_dict d on w.productcode=d.code left outer join t_balancecode b on w.balancecode=b.balancecode where 1=1 and w.operdate>TO_TIMESTAMP('2009-11-2 04:12:32.0', ' ......
近段时间很多网友提出监听配置相关问题,客户终端(Client)无法连接服务器端(Server)。本文现对监听配置作一简单介绍,并提出一些客户终端无法连接服务器端的解决思路,愿对广大网友与读者有一些帮助。
一、监听器(LISTENER)
监听器是Oracle基于服务器端的一种网络服务,主要用于监听客户端向数据库服务器端提 ......