Tags: javawebAn experimental purpose1 familiar with the use of myeclipse. 2 Master the use of MySQL. 3 Master the JDBC Connection database. Two experimental contents1 Create a database students under MySQL, and create a table student_info. and enter a record. 2 import the MySQL jdb
/** * Function: Demo using JDBC-ODBC bridge connection to manipulate SQL database * Xu Shouwei * Operation steps: * 1. Configure Data source * 2. Connect data source in program * 3. Operation data */package com.jasxu; Introduction of SQL packet import java.sql.*; public class T1 {/** * @param args */public static void main (string[] args) {//TODO auto-generated m
Design | data | database | database connection
Pick
to beThis paper introduces the working principle of database connection pool based on JDBC, expounds the key technologies such as transaction processing of
Main talk through DriverManager connectionDriverManager is a managed class of drivers.1). The database connection can be obtained through the overloaded getconnection () method. More Convenient2). Multiple drivers can be managed at the same time: If multiple database connections are registered, call getconnection ()method, a different
Example of JDBC database accessJAVA's cross-platform processing capabilities (Write Once, Run Anywhere) and excellent image processing capabilities (I believe there is no such language that can surpass JAVA's network processing capabilities) network communication functions, JDBC da
to Oracle Database public class Orcaledbutil {public static final String DRIVER = "Oracle.jdbc.driver.OracleDriver";public static final String URL = "Jdbc:oracle:thin: @localhost: 1521:ORCL";public static final String USER = "dan_1";//Database namepublic static final String PWD = "1234567";//Passwordpublic static Connection Getoracleconnection () {
First, place the drive jar package in a Lib package in the server (e.g. Tomcat) directory to have the server automatically manage the database connectionB. In the Meta-inf folder in the project root, build the context.xml file, where you need to configure the data source1234Auth= "Container"5Type= "Javax.sql.DataSource"6 7Username= "Scott"8Password= "123"9Url= "Jdbc:oracle:thin: @localhost: 1521:orcl"TenDriverclassname = "Oracle.jdbc.drive
Tags: into count database meta Red pre CTI stat JDBCmanipulating databases through JDBC PackageHead18; Importjava.sql.Connection;ImportJava.sql.DriverManager;ImportJava.sql.ResultSet;Importjava.sql.SQLException; Importjava.sql.Statement; Importcom.mysql.jdbc.PreparedStatement; Public classJDBC { Public Static voidMain (string[] args) {//Load Driver
Try{class.forname ("Com.mysql.jdbc.Driver"); Sy
= (address = (host = 192.168.60.132) (protocol = tcp) (port = 1521) (address = (host = 192.168.60.144) (protocol = tcp) (port = 1521) (load_balance = yes) (failover = yes) (connect_data = (service_name = oratest )))
However, tomcat reports the following error:
Io Exception: NL Exception was generated;
2. google and baidu on the Internet. Although the n method is found, the error is always prompted;
3. In desperation, open the database tnsname.
'";// St.executeupdate (SQL); Additions and deletions are used this execution of the statement because of the update database String sql = "SELECT * from the person"; ResultSet rs=st.executequery (SQL); Query with this executive languageThe result of the sentence query is saved in the result set ResultSet class object Rs in while (Rs.next ()) { Rs.next () returns true if the result set RS has the
objectPanax Notoginseng stsm.executequery (); - the /** + * 6: Get the value of the output parameter A * Based on the index value, that is, the location of the output parameters in the precompiled SQL language the */ +String result = stsm.getstring (2); - System.out.println (Result); $ } $ Catch(Exception e) { - e.printstacktrace (); - Throw NewRuntimeException (e); the } - //7: Close the connectionWuyi
Tags: get root connections col Drive path Ali Mys ResultSetJDBC Connection database Five steps: One, load drive Class.forName ("com.mysql.jdbc.Driver"); Second, establish the connection Connection conn = drivermanager.getconnection ("jdbc:mysql://localhost:8080/database name
(ClassNotFoundException e) {System.out.println ("Driver class not found, add to failure");E.printstacktrace ();}After a successful load, an instance of the driver class is registered in the Drivermanger class.2), provide the URL of the JDBC connectionThe connection URL defines the protocol, sub-protocol, and data source identity when the database is connected.Wr
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.