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
The Blob field in Oracle is special. It has much better performance than the long field and can be used to save binary data such as sample slices.Writing Blob fields is very different from writing other types of fields. Because Blob itself has a cursor, you must use cursor to operate blob. Therefore, before writing Blob, you must obtain the cursor to write data. How can you obtain the Blob cursor?This requires you to insert an empty blob first, which
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
When using this method, you need to add the Oracle jar package to the classpath variable. This package can be found in $ ORACLE_HOME/jdbc/lib/classes12.jar of the oralce client program.
Import java. SQL .*;
Public class jdbcthin {// Dburl database connection string information, where "1521" is the port and "ora9" is the SIDString dburl = "JDBC:
and writing blob/clob fields, that is, bufferedinputstream, bufferedoutputstream, bufferedreader, bufferedwriter. All the routines use the buffer operation class.Summary: Using JDBC to manipulate the lob field of an Oracle database is not difficult to grasp, except to insert, modify, replace, and read data. In practice, pay attention to the points mentioned above. In combination with the reading routine so
Due to Oracle licensing issues, MAVEN3 does not provide Oracle JDBC driver, in order to apply Oracle JDBC driver to the MAVEN project, it must be added to the local repository manually.
This document is for Oracle 11g. first, to g
to note that the following: MSSQL download Sqljdbc4.jar placed under Apache-jmeter-2.6\lib
Datebase
Driver class
Database URL
Mysql
Com.mysql.jdbc.Driver
Jdbc:mysql://host:port/{dbname}
PostgreSQL
Org.postgresql.Driver
Jdbc:postgresql:{dbname}
Oracle
Oracle.jdbc.driver.OracleDriver
Jdbc:oracle:thin:user/[email P
that the following: MSSQL download Sqljdbc4.jar placed under Apache-jmeter-2.6\lib
Datebase
Driver class
Database URL
Mysql
Com.mysql.jdbc.Driver
Jdbc:mysql://host:port/{dbname}
PostgreSQL
Org.postgresql.Driver
Jdbc:postgresql:{dbname}
Oracle
Oracle.jdbc.driver.OracleDriver
Jdbc:oracle:thin:user/[email Protected
.
For a BLOB type, apply the Inputstream/outputstream class, which does not encode conversions, byte-per-access. The Oracle.sql.BLOB class provides the Getbinarystream () and Getbinaryoutputstream () two methods, which are used to read the Oracle BLOB field. The latter method is used to write data to an Oracle BLOB field.
For the CLOB type, the Reader/writer class is applied, and this class is encoded
Because of Oracle licensing issues, MAVEN does not provide Oracle JDBC driver, which must be manually added to the local warehouse in order to apply the Oracle JDBC driver in the MAVEN project.I. Obtaining the Oracle
enterprise-wide approach that adapts to a single database and a clustered database, with superior performance, especially with connection pooling, which greatly improves application performance and concurrency. Disadvantage: If you want to use OCI, you must install the Oracle client. After installing the Oracle client, there is a JDBC folder in which the OCI dri
Due to Oracle licensing issues, MAVEN3 does not provide Oracle JDBC driver and must be manually added to the local warehouse in order to apply the Oracle JDBC driver in the MAVEN project.first, to get the Oracle
Due to Oracle licensing issues, MAVEN3 does not provide Oracle JDBC driver, in order to apply Oracle JDBC driver to the MAVEN project, it must be added to the local repository manually.
1. Download the corresponding version thro
Add the Oracle JDBC driver to the Maven Repository
Due to Oracle authorization problems, Maven3 does not provide Oracle JDBC driver. To Apply Oracle JDBC driver to Maven projects, you m
Label:Maven adds Oracle JDBC dependencyBecause of Oracle licensing issues, MAVEN does not provide Oracle JDBC driver, which must be manually added to the local warehouse in order to apply the Oracle
Because of Oracle licensing issues, MAVEN does not provide Oracle JDBC driver, which must be manually added to the local warehouse in order to apply the Oracle JDBC driver in the MAVEN project.First, you need to download the OJDBC
Label:Because of Oracle licensing issues, MAVEN does not provide Oracle JDBC driver, which must be manually added to the local warehouse in order to apply the Oracle JDBC driver in the MAVEN project.First, you need to download the
Tags: uil www art one file drive pre connection Count dependentOne, when we need to connect to a database in a MAVEN project, we only need to configure its dependencies, but Maven does not provide Oracle JDBC driver, which is not available due to Oracle licensing issues and needs to be added manually. Second, get the jar package that connects to the database, her
Label:Using JDBC to connect to the database, fly is divided into three steps: The first step: Download a JDBC driver, then throw the jar package into the project and add to build path; Step two: Go to the local Oracle folder to find "TNSNames." ORA "file, open the connection string to locate the corresponding database,
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.