JDBC Connection Oracle Database method

Source: Internet
Author: User
Tags connection pooling oracle database

Import java.sql.*;

Several problems needing attention in JBuilder correctly connecting Oracle Arrayi
Oracle8 above should all use the Classes12.jar file as JDBC driver;
Correctly set up the enterprise Setup, configure libraries in Windows Classpath and JBuilder, and add the Casses12.jar path to the place where you need to set up.
Enter the database pilot, in the database pilot, file---New in the driver list if the Oracle driver is red, it means that your oralce failed to load in JB;
If ③ is not wrong, create a new url:jdbc:oracle:thin:@ (Yourhostname): 1521: (Your SID)
Username/password for connecting to a database tutorial
Note: Most of the JBuilder connections to Oracle are caused by improper configuration of classpath.
Connecting Oracle databases with non-XA methods
Be aware of two points when configuring Oracle_xa under Windows:

#ORACLE 10
Oracle_xa;xaosw;%o Racle_home% DBMS Oraxa10.lib%oracle_home%precompibmsvcorasql10.lib

#oracle Array
Oracle_xa;xaosw;%o Racle_home% DBMS Oraxaarray.lib%oracle_home%precompibmsvcorasqlarray.lib

Under Unix
ORACLE_XA:XAOSW: .....

First: After Windows Oracle_xa and XAOSW are semicolon ";", not colon ":"
Second: The above Lib write on a line, the middle with a space apart, if not in the system environment variable set oracle_home, write absolute path.

' Java.sql.SQLException:IO exception, not in streaming mode ' when JDBC operates Oracle database
With Oraclestatment, don't use java.sql.Statment.
If Setautocommit fails for an existing connection, close the connection and re-establish a connection
Download the latest JDBC Driver to the Oracle site, and if you operate the LOB type, Oracle-brought interfaces and classes
WebLogic Connection Oracle Problem: The network Adapter could not establish the connection

May be the server's listening to stop, is the problem of the database, and the application is irrelevant; should first check whether Oracle is normal, with Sql*plus connection database, see whether normal connection;

2///JDBC Connection Database
3 public class ZZ {
4
5/**
6 * @param args
7/
8 Publi c static void Main (string[] args) {
9//TODO auto-generated Method stub
'
One try
' {
13 Load driver
Class.forName ("Oracle.jdbc.OracleDriver");
Connection con=drivermanager.getconnection ("Jdbc:oracle:thin:@127.0.0.1:1521:oracle", "Scott", "m123");
Statement sm=con.createstatement ();
ResultSet rs=sm.executequery ("SELECT * from emp");
System.out.println ("User name: +" Position: "+" Supervisor Number: "+" Entry Time: ");
while (Rs.next ())
{
System.out.println
(rs.getstring (2) + "" +rs.getstring (3) + "" +rs.getst Ring (4) + "" +rs.getstring (5));
N
}
Rs.close ();
Sm.close ();
Con.close ();
}
catch (Exception e)
{
to E.printstacktrace ();
+}



}

Considerations for using Oracle connection pooling and Oracle backups in Eblogic
Using Hp-unix,weblogic 8.1,oracle array.2.0.5
Configured with a common connection pool, the driver uses Oracle's Oracle ' s Driver (Thin) version array.0.1, array.2.0

Error condition:
Results using database connection pool The times are wrong and say there is no connection pool resource. In fact, the database connection pool is completely idle, and the test is also true, Oracle is also normal to connect, use.

Problem Root:
Through the layers of error, found that the original backend in the use of Oracle's exp backup a only synonym users, resulting in the exp process zombie.
Unable to resolve the problem by killing Exp, restarting Oracle, and eventually restarting Unix, it is forbidden to back up only synonyms for users, problem solving.

Summarize:
should be Oraclearray exp bug causes connection pooling problem, do not use exp to pour out synonyms

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.