可以用下面的办法:1.装载Oracle自带的Java包;2.装载MSSQL的JDBC驱动(或第三方的驱动);3.在Java存储过程中调用,如下:
Connection conn = null; Statement stmt = null; String strUser="user"; String strPass="pass"; String strDbname ="DB_demo"; Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"; String url="jdbc:microsoft:sqlserver://10.1xx.1xx.x:1433"; conn= DriverManager.getConnection(url,strUser,strPass); conn.setCatalog( strDbname ); stmt = conn.createStatement(); String strSql = "Select ......."; ResultSet rs = stmt.executeQuery(strSql); stmt.close(); conn.close();
取消
评论