1. Create a table
Create Table stud (Sid int,Sname varchar2 (50 ),Age number,Score number (4, 2 ))And insert some data (manually insert some data)2. Create a function
Create or replace function fun_getscores (V_age in stud. Age % Type)Return numberIsV_score number;BeginSelect sum (score) into v_score from stud where age> v_age;Return v_score;-- Exception HandlingExceptionWhen others thenDbms_output.put_line (sqlcode | sqlerrm );Return-1;End;3. Call in JDBC
Tags: confluenceFor license-based considerations, we cannot bundle Oracle drivers into confluence. If you want your confluence to be able to connect to an Oracle database, you need:
Stop confluence.
Go to the Database JDBC Drivers page and download the correct driver. The
Because of Oracle commercial copyright issues, MAVEN cannot download jar packages directly through the central repository, and if you want to use jar packs, you need to manually process them.
Step One: Place the Ojdbc14.jar in the user's directory, such as: C:\Users\qicyt1812
Step Two: Execute the command in cmd: mvn install:install-file-dgroupid=com.oracle-dartifactid=ojdbc14-dversion=10.2.0.1.0- Dpackaging=jar-dfile=ojdbc14.jar
C:\USERS
") + "~" +rs.getstring ("sal") + "~" +rs.getstring ("comm") + "~" +rs.getstring (" Deptno)); } } //Access single return value store function create or Replace function X (Eno in number) return number//{? = call Public voidfunction ()throwsSQLException {String SQL= "{? = Call X (?)}"; Pager=conn.preparecall (SQL); //the input is the same as before PreparestatementCall.setint (2, 7788); //what type of output is the parameter to register?Call.registeroutparameter (1, Oracletypes.numb
driver package introduced in the demo, which includes the oracleconnectionpooldatasource class that implements the database connection pool., You need to go to the Oracle website to download according to your own database version (click to open the link ). The Code is as follows:
Pooldbsource class
Package COM. ***. connectionpool. DB; import Java. SQL. connection; import Java. SQL. sqlexception; import ja
Import java. SQL .*;
Public class ora8iconnect{Public ora8iconnect (string dB, string ID, string PWD){Dbname = dB;Userid = ID;Userpwd = PWD;Beginconnect (); // connect to the database}/*-* Returns a connection object.*/Public connection getconnection () {return conn ;}
/*-* Connect to the database. If the connection succeeds, 1 is returned. Otherwise, 0 is returned.*/Public int beginconnect (){Try{// Load an oracle driverDrivermanager. register
.
"The FROM keyword was not found at the desired location"
923
42000
SELECT ename EMP
"Missing expression"
936
42000
SELECT from EMP
"Table or view does not exist"
942
42000
SELECT ename from Empp
"Cannot insert null value"
1400
23000
An attempt was made to insert a null value into a column that contains a not NULL constraint
"Value is greater than specified precision for this column"
In the SPRINGMVC framework, Oracle Data sources are configured in Spring-servlet.xml as follows:
destroy-method= "Close" >
The exception is as follows:
caused by:org.springframework.jdbc.CannotGetJdbcConnectionException:Could not get JDBC Connection; Nested exception is org.apache.commons.dbcp.SQLNestedException:Cannot create JDBC
1, to the database, the table of each row of data record additions and deletions to changeAdd: INSERT into Table name values ()Delete: Delete table name where condition (id=? )Change: Update table name set column name =? Where Condition (id=? )Check: Select column name from table name where id=? Look up a piece of informationSelect Column name from table name order by ID check all information2. ResultSet result setis an interface that points to a pointer to the current data row, starting at the
Tags: CTI aging 1.0 end Jar Div Pen Oracle LenovoMVN Install:install-file-dgroupid=com.oracle-dartifactid=ojdbc6-dversion=11.2.0.1.0-dpackaging=jar-dfile=d:\app \lenovo\product\11.1.0\db_1\jdbc\lib\ojdbc6.jar (Driver package in Oracle installation directory)Pom file after installation is completeNote: The groupid,artif
js|oracle| Page | data | database | Show
Variable declaration
Java.sql.Connection Sqlcon; Database Connection objects
Java.sql.Statement sqlstmt; SQL Statement Object
Java.sql.ResultSet Sqlrst; Result set Object
Java.lang.String Strcon; Database connection string
Java.lang.String strSQL; SQL statement
int intpagesize; Number of records displayed on one page
int introwcount; Total Records
int intpagecount; Total pages
int intpage; Page number to dis
Tags: group HTTP technology share local repository maven add res COM successOracle does not support the download of Maven repositoriesWorkaround:1: Go to Oracle Download the required drive jar packageHttp://www.oracle.com/technetwork/database/features/jdbc/default-2280470.html2: Local command packs the jar package into a jar package under MavenMVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbC7-
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.