JAVA 连接ORACLE数据库代码
import java.net.url;
import java.sql.*;
public class javaoracle {
public javaoracle() {
}
public static void main(string[] args){
try
{
try{
class.forname("oracle.jdbc.driver.oracledriver");
}
catch(java.lang.classnotfoundexception e)
{
system.err.print(e.getmessage());
}
string url="jdbc:oracle:thin:@server:1521:sdcdb";
connection conn=drivermanager.getconnection(url,"test","test");
statement stmt=conn.createstatement();
resultset rs=stmt.executequery("select score from my");
while(rs.next())
{
system.out.println(rs.getstring(1));
}
conn.close();
}
catch(sqlexception ex)
{
while(ex!=null)
{system.out.println(ex.getsqlstate());
}
}
}
}
///////////////////////
在try{}中: Class.forName("oracle.jdbc.driver.OracleDriver");
//将OracleDriver载入JVM对象池
抛出:ClassNotFoundException
3.连接数据库: Connection con=DriverManager.getConnection("jdbc:oracle:thin:ordertemp/ordetemp@localhost:1521:GY");
数据库类型标识符: jdbc:odbc:thin
登陆用户名: ordertemp
登陆密码: ordertemp
数据库服务器IP地址:localhost (或者用127.0.0.1,如果是网络,则为URL)
数据虚拟端口号: 1521 (oracle默认端口号) //(sqlserver默认端口号1433)
数据库SID: GY
抛出:SQLException
4.创建Statement对象(PreparedStatement也可以)
Statement stm=con.createStatement();
PreparedStatement psm=con.prepareStatement(String sql);
5.执行相关SQL查询语句及获得结果。
6.结束之后,必须使用: stm.close();  
相关文档:
1 查看oracle的版本信息
(1)用客户端连接到数据库,执行select * from v$instance
查看version项
(2)select * from product_component_version
(3)或查询V$VERSION查看组件级信息 ......
停止数据库,停止服务。
然后在运行升级程序时出现Error:OUI-10133:Invalid stageing area. there
are no top level components
错误,半天不得其解。终于发现是因为升级包解压不完全造成的。重新复制一份完整解压过的,升级。OK. ......
CREATE OR REPLACE FUNCTION OFFICE.fbill_getbalance (billid NUMBER, total NUMBER)
RETURN NUMBER
IS
paid NUMBER;
balance NUMBER;
BEGIN
balance := total;
--get total paid
SELECT SUM (n_paidamount)
&nb ......
###author:hiphop###
###qq:70381908###
为什么要关注 Oracle ?
因为Oracle 被大量企业所使用,有许多目标可以选择来渗透
许多企业都没有更新且有潜在的方险!
提权非常简单,容易拿到shell!!
读了blackhat paper 让我开始来研究Oracle
因为他只讲到一小部份 真正安全问题还有很广的
只是国内好像很少挖掘
因为遇到 ......