1 PackageCom.xyyz.jdbc;2 3 Importjava.sql.Connection;4 ImportJava.sql.DriverManager;5 Importjava.sql.PreparedStatement;6 ImportJava.sql.ResultSet;7 8 Public classJdbcdemo {9 Ten Public Static voidMain (string[] args)throwsException { One
various Database Drivers
Database name
Description
Mysql
http://www.mysql.com/products/connector/j/
Shipped. But need to download the latest for MySQL 4.1 or higher.
Oracle
Java connection all kinds of database way quick look-up table
1, oracle8/8i/9i database (thin mode)
Class.forName ("Oracle.jdbc.driver.OracleDriver"). newinstance ();String url= "Jdbc:oracle:thin: @localhost: 1521:ORCL"; ORCL is the SID of the
The following is a list of how the various databases use JDBC connections and can be used as a manual.
1, oracle8/8i/9i database (thin mode)
Class.forName ("Oracle.jdbc.driver.OracleDriver"). newinstance ();
String url= "Jdbc:oracle:thin:
Now have a lot of novice JSP users will often ask the database how to connect ah, how old mistakes ah? So I concentrated in this write an article for your reference, in fact, this database logic all put in the JSP may not be a good practice, but is
js| Program | Connection database
First, JSP connection oracle8/8i/9i database (with thin mode)
Testoracle.jsp is as follows:
String url= "Jdbc:oracle:thin: @localhost: 1521:ORCL";ORCL for the SID of your databaseString user= "Scott";String password=
js| Data | database
First, JSP connection oracle8/8i/9i database (with thin mode)Testoracle.jsp is as follows:String url= "Jdbc:oracle:thin: @localhost: 1521:ORCL";ORCL for the SID of your databaseString user= "Scott";String password=
Java connection instances of various databasesSource: Net all over the world
The code in this article mainly lists the key code to connect to the database, and the other Access database code omits
1, oracle8/8i/9i database (thin mode)Class.forName ("
There are two main ways to connect a database with Java, one is to connect with the Jdbc-odbc bridge, the other is to connect with the corresponding driver provided by the manufacturer, first of all to talk about the first connection.
The JDBC-ODBC
js| Connection Database Now there are a lot of beginners JSP users will often ask the database how to connect ah, how old mistakes ah? So I concentrated in this write an article for your reference, in fact, this database logic all put in the JSP may
js| Data | Database Now there are a lot of beginners JSP users will often ask the database how to connect ah, how old mistakes ah? So I concentrated in this write an article for your reference, in fact, this database logic all put in the JSP may not
When I first approached JDBC, I sometimes wondered why Java had to use JDBC instead of directly using ODBC, which was previously studied in VB, because ODBC was present before JDBC, so ODBC must be unable to complete certain operations, or it could
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.