js| Package | data | database
Using beans in JSP to encapsulate the common features of a database
1. Create a Bean
Package guestbook; import java.sql.*; public class Sql_data { String sdbdriver= "Sun.jdbc.odbc.JdbcOdbcDriver"; String sconnstr=
Using System;
Using System.Configuration;
Using System.Data;
Using System.Data.SqlClient;
Using System.Collections;
Namespace MyCorporation.DepartMent.DataBase
{
Common database Classes
public class DataBase
{
private string connstr = null;
Public
Create a program that connects the database with JDBC, which contains 7 steps:
1. Load JDBC Driver:
Before connecting to a database, you first load the drive to the JVM (the Java Virtual machine) of the database you want to connect to, which is
asp.net| Access | encapsulation | data | database using System;
Using System.Configuration;
Using System.Data;
Using System.Data.SqlClient;
Using System.Collections;
Namespace MyCorporation.DepartMent.DataBase
{
Common database Classes
public
Java database connection (Java DB connectivity abbreviation JDBC) download JDBC Driver: https://dev.mysql.com/downloads/connector/j/ The Windows system downloads the. zip file package, Linux platform download tar.gz package to find the
First Class:Package dina.web.test;Import java.sql.*;public class DBHelper {public static final String DRIVER = "Com.mysql.jdbc.Driver";public static final String URL = "Jdbc:mysql://58.215.50.62:3307/iov";public static final String USER = "Iov_user";
1. Create a bean
Package guestbook;Import java. SQL .*;/*** Title: connect to the database with JavaBean* Description: encapsulate common database functions with bean and declare the bean in JSP.* Copyright: Copyright (c) 2001* Company: Speed
After nearly one day, I finally connected to the MySQL database. Here is a brief summary:
1. Configure the MySQL database first.
2. Download the MySQL driver mysql-connector-java-5-jar and add it to the current project
Package second; import Java.
As we all know, most of the Web site news or product information are static pages. The advantages of this is mainly to: 1, speed up access, avoid excessive operation of the database; 2, SEO optimization, easy search engine included.
This example
1, Db.class.php
Connecting to a databaseClass Db {static public Function Getdb () {try {$pdo = new PDO (DB_DSN, Db_user, db_pwd);$pdo->setattribute (Pdo::attr_persistent, true); To set a database connection as a persistent
Source Author: follow-up1. Create a BeanPackage guestbook;Import java. SQL .*;/*** Title: connect to the database with Javabean* Description: encapsulate common database functions with Bean and declare the Bean in JSP.* Copyright: Copyright (c) 2001*
Generate static html in PHP in batches (run PHP in command line ). As we all know, most website news or product information is static pages. The main benefits of doing so are: 1. speed up access and avoid excessive database operations; 2. as we all
1. SQL statement execution process in Android sqlite
All SQL statements in SQLite must be compiled into stmt and then executed.
First, let's take a look at the SQLiteDatabase. update () process.
// SQLiteDatabase. javapublic int update (String
As we all know, most website news or product information is static pages. The main benefits of doing so are: 1. Speed up access and avoid excessive Database Operations; 2. SEO optimization to facilitate search engine indexing.
This example describes
Three methods for connecting Java JDBC Thin Driver to Oracle1. JDBC connection Oracle explain JDBC application connection Oracle problems, the error is as follows: ORA-12505, TNS: listener does not currently know of SID given in connect descriptor
As we all know, most of the website news or merchandise information are static pages. The advantage of this is mainly to: 1, speed up access, avoid too much operation of the database, 2, SEO optimization, easy to collect search engines.
This
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.