Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use the mysql_jdbc driver of JSP

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces how to install and use the mysql_jdbc driver of JSP. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

The editor only briefly describes the installation and use of mm.mysql.

Installation

1. Download mm.mysql

2. Extract to a drive, such as c:

3. Modify classpath and add the path to mm.mysql. For example, your original classpath may be:

; c:jdk1.2.2lib ools.jar;c:jdk1.2.2libdt.jar

After modification, it may be

; c:jdk1.2.2lib ools.jar;c:jdk1.2.2libdt.jar;C:mm.mysql.jdbc-2.0pre5

Programming

1. Register mm.mysql with DriverManager

The class of mm.mysql is called org.gjt.mm.mysql.Driver and must be written as

Class.forName (org.gjt.mm.mysql.Driver) .newInstance ()

2. Jdbc url parameter description

Url format: jdbc:mysql:// [hostname] [: port] / dbname [? param1=value1] [roomm2 = value2].

The default value of parameter name

User database user name none

Password database user password is missing

AutoReconnect whether to connect automatically when the database connection is lost. Value: true/false false.

MaxReconnects if autoReconnect is true, this parameter is the number of retries. The default is 3 times.

InitialTimeout if autoReconnect is true, this parameter is the number of seconds to wait before reconnecting 2

MaxRows sets the number of rows returned when querying. 0 means all 0.

Whether useUnicode uses unicode output, true/false false

CharacterEncoding if useUnicode, this parameter defines the encoding type. It is recommended to use 8859. None.

Prompt

Using useUnicode,characterEncoding at the same time can solve the Chinese problem of database output.

Such as: jdbc:mysql://localhost/test?user=root&useUnicode=true;characterEncoding=8859_1

A practical example, a simple example.

This jsp example uses a library that has only one table (address book).

Create database addressbook

Use addressbook

Create table addressbook (id int auto_increment primary key,name varchar (30), address varchar (255), phone varchar (20))

Insert record

Insert into addressbook (name,address,phone) values (jjx,zhejiang yuyao,0574-2222222)

Jsp code: absolute,ResultSet.TYPE_SCROOL_SENSITIVE and other directories are used in the code to test whether mm.mysql conforms to the jdbc 2.0 specification.

[@ more@]

Undefined

On how to install and use JSP's mysql_jdbc driver is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report