1. Create a table:
Create Table stud (Sid int,Sname varchar2 (50))Insert a data recordInsert into stud values (1, 'Tom ')
2. Define a cursor through the packageCreate or replace package pack_studIs-- Declare a cursor typeType cur is ref cursor;End;3. Create a stored procedure
Create or replace procedure pro_select_stud (My_cur out pack_stud.cur)IsBeginOpen my_cur for select * from stud;End;
4. Call in JDBC
Import java. SQL. callablestatement;Import ja
When you connect to an Oracle database using the Tools information design tool of SAP Businessobject BI, the default JDBC driver without Oracle is IDT, and you need to manually configure its drivers, as follows: Download Oracle's JDBC dr
user, String password );
Note: Obtain the database connection according to the url. the user is the username used to log on to the database, and the password is the login password.
Database url Description: The url is written as: localhost can be replaced by the return address 127.0.0.1 pointing to the Local Machine
Common Database url:
Oracle -- jdbc: oracle: t
Tags: size basename search get state data connection 1.5 password differentThe JDBC connection data is a key point of javaweb development, and today we summarize and deepen our memory. The JDBC Connection database is divided into three steps: 1: Load Driver Need to download the respective drive jar package, you can go to the Internet search. Template: load
Tags: cal creat png div src rest key cti User1, follow Oracle 2, CREATE DATABASE footsteps DROP TABLE person;
DROP SEQUENCE myseq ; //Set the self-increment sequence.
CREATE SEQUENCE myseq;
CREATE TABLE person
(
ID int. PRIMARY KEY not NULL,
name VARCHAR (#) not NULL,
age INT,
birthday DATE
); 3, then configure the driver. 4, execute: Get program: Dbdrive
Oracle.jdbc.driver.OracleDriver.getConnectionInstance (oracledriver.java:442) At Oracle.jdbc.driver.OracleDriver.connect (oracledriver.java:321) At Org.apache.commons.dbcp.DriverConnectionFactory.createConnection (driverconnectionfactory.java:38) At Org.apache.commons.dbcp.PoolableConnectionFactory.makeObject (poolableconnectionfactory.java:294) At Org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory (basicdatasource.java:1247) At Org.apache.commons.dbcp.BasicDataSource.createDataS
dburl= "Jdbc:oracle:thin: @localhost: 1521:ORCL";//connecting to an Oracle databaseString username= "admin";//login account and password for the databaseString password= "Admin"; Connection=drivermanager.getconnection (Dburl,username,password); String SQL= "SELECT * FROM Student"; //Create a PreparedStatement object to send the parameterized SQL statement to the database. Preparedstatement=connection.preparestatement (SQL); RS=preparedstatement.execu
No suitable driver found for jdbc:oracle:thin:@192.168.7.146:1521:oracleThe reasons for this error are mainly the following:1. URL configuration error (similar to the following)2. JDK version, JDBC version, and error caused by inconsistent database version.The first thing to ensure that your database supports the corresponding JDBC version, and then according to
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
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:
JDBC reading of Oracle US7ASCII encoding Chinese garbled characters and the use of Chinese Characters in different encodings
Database Version: Oracle 10g
Character Set: SIMPLIFIED CHINESE_CHINA.US7ASCII
JDK: 1.6.0 _ 45
Oracle DRIVER: ojdbc14.jar
It is no problem to use
Tags: success share style art finish catalog cmd ora strOracle is paid, so the jar package is not a casual one, which can cause Maven to download and compile, because we can't go directly to the MAVEN repository. The solution is to get the jar package from somewhere else and put it in the local repository so that you can run Maven successfully. I am now compiling the oracle11g jar package, the Pom file is dependent on the following First to get the jar, usually to the
1. Create a jdbc.properties file driver=oracle.jdbc.driver.oracledriverurl=jdbc:oracle:thin:@127.0.0.1:1521:orclusername=systempassword=1234562. Create a connection tool PackageCom.util;Importjava.sql.Connection;ImportJava.sql.DriverManager;Importjava.sql.SQLException;Importjava.util.Enumeration;ImportJava.util.ResourceBundle; Public classORACLEJDBC {Private StaticString driver; Private StaticString URL; P
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.