oracle连接数据库测试代码
oracle连接数据库测试代码
/**
*
* 说明:
* (1)本例使用JDBC_ODBC桥进行数据库连接,故此需要ODBC数据源
* (2)本例中SQL为更新语句,故此使用载体的executeUpdate方法,并且返回受影响记录数
* (3) 配置连接ORACLE的odbc数据源ora
*/
//导入所需类包
import java.sql.*;
public class JdbcTestOra2 {
public static void main(String args[]) {
try {
//装载驱动程序
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//建立数据库连接
Connection con =
DriverManager.getConnection("jdbc:odbc:ora","scott","tiger");
//创建SQL语句载体
Statement st = con.createStatement();
//执行SQL语句,接收执行结果
int rs = st.executeUpdate("update emp set
comm=1000");
//处理结果
System.out.println("修改记录数:"+rs);
//释放数据库资源,注意顺序
st.close();
con.close();
}
catch (Exception e) {
e.printStackTrace(System
相关文档:
修改oracle 10g的字符集
修改数据库字符集为:ZHS16GBK
首先用scott&tiger&orcl登录到sql/plus
查看服务器端字符集
SQL > select * from
V$NLS_PARAMETERS;
修改:
$sqlplus /nolog
SQL>conn / as sysdba
若
此时数据库服务器已启动,则先执行 SHUTDOWN IMMEDIATE 命
令关闭数据库服务器,然后执 ......
1、查询两个日期之间的数据。
假设有表Table1,其创建表的sql语句为:
create table Table1(
StationID NUMBER(10) Primary key,
Year NUMBER(4) not null,
Month NUMBER(2) n ......
The DB File Scattered Read wait event generally indicates waits related to full table scans or fast
full index scans. As full table scans are pulled into memory, they are scattered throughout the
buffer cache, since it is usually unlikely that they fall into contiguous buffers. A large numb ......
1.LVM:
[root@vmfs ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdg
VG Name db_v4
PV Size  ......
Wait Problem Potential Fix Sequential Read Indicates many index reads—tune the code (especially joins) Scattered Read Indicates many full table scans—tune the code; cache small tables ......