第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

eclipse中編譯出錯

package?demo.utils;



import?java.sql.Connection;
import?java.sql.DriverManager;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?java.sql.Statement;

public?class?JDBCUtils?{
?????public?static?String?driver?="oracle.jdbc.oracleDriver";
?????public?static?String?url="jdbc:oracle:thin:@localhost:ocrl";
?????public?static?String?user="scott";
?????public?static?String?passworld="tiger";
?????
?????//注冊數(shù)據(jù)庫驅(qū)動
?????static?{
????	?try?{
			Class.forName(driver);
			//?DriverManager.registerDriver(driver);
		}?catch?(ClassNotFoundException?e)?{
			//?TODO?Auto-generated?catch?block
			e.printStackTrace();
			throw?new?ExceptionInInitializerError(e);
		}
?????}
????//獲取數(shù)據(jù)庫連接
?????public?static?Connection?getConnection(){
????	????try?{
				return?DriverManager.getConnection(url,?user,?passworld);
			}?catch?(SQLException?e)?{
				//?TODO?Auto-generated?catch?block
				e.printStackTrace();
			}
????	????return?null;
?????}
?????//釋放數(shù)據(jù)庫資源
?????public?static?void?release(Connection?conn,Statement?call,ResultSet?rt){
????	?if(rt!=null){
????		?try?{
				rt.close();
			}?catch?(SQLException?e)?{
				//?TODO?Auto-generated?catch?block
				e.printStackTrace();
			}finally{
				rt=null;
			}
????		?if?(call!=null){
????			??try?{
					((Connection)?call).close();
				}?catch?(SQLException?e)?{
					//?TODO?Auto-generated?catch?block
					e.printStackTrace();
				}finally{
					call=null;
				}
????		?}
????		?if?(conn!=null){
????			?try?{
					conn.close();
				}?catch?(SQLException?e)?{
					//?TODO?Auto-generated?catch?block
					e.printStackTrace();
				}finally{
					conn=null;
				}
????		?}
????	?}
?????}
}
package?demo.oracle;

import?java.sql.CallableStatement;
import?java.sql.Connection;

import?org.junit.Test;

import?demo.utils.JDBCUtils;
import?oracle.jdbc.internal.OracleTypes;

public?class?TestFunction?{
	@Test
??????public?void??testFunction(){
????	?????String?sql="?call?qureyempincome(?)";
????	??????Connection??conn=null;
????	??????CallableStatement?call=null;
????	??????try?{
????	????	//得到數(shù)據(jù)庫鏈接
????	????	??conn=JDBCUtils.getConnection();
????	????	//基于鏈接創(chuàng)建statement
????	????	??call=conn.prepareCall(sql);
????	????	??//對于輸出參數(shù)?申明
????	????	??call.registerOutParameter(1,OracleTypes.NUMBER);
????	????	??//?對于輸入?yún)?shù)?賦值?
????	????	??call.setInt(2,?7839);
????	????	??//執(zhí)行調(diào)用
????	????	??call.execute();
????	????	??//取年收入的結(jié)果輸出
????	????	??double?income?=call.getDouble(1);
????	????	??System.out.println("該員工的年收入是:"+income);
????	??????}catch(Exception?e){
????	????	??e.printStackTrace();
????	??????}finally{
????	????	??JDBCUtils.release(conn,?call,?null);
????	??????}
??????}
}

java.lang.ClassNotFoundException: oracle.jdbc.oracleDriver

at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:264)

at demo.utils.JDBCUtils.<clinit>(JDBCUtils.java:20)

at demo.oracle.TestFunction.testFunction(TestFunction.java:19)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


正在回答

2 回答

driver類是Oracle.jdbc.driver.OracleDriver注意區(qū)別大小寫,然后就是環(huán)境變量以及驅(qū)動、數(shù)據(jù)庫版本問題。

0 回復(fù) 有任何疑惑可以回復(fù)我~

好的,謝謝

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

eclipse中編譯出錯

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號