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 solve the problem of driver conflict in the Development of JSP website

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to solve the JSP website development in the driver conflict problem, Xiaobian feel quite practical, so share to you as a reference, I hope you can read this article after harvest.

Enthusiastic people on the network summed up the shortcomings of Microsoft drivers in JSP website development:

(1) If jdbc-odbc driver is used, then it must be read once in query order (regardless of image or text type).

(2) If the MS SQL Server jdbc driver provided by Microsoft is used, if there is no image or text type field in the query statement, it can be obtained in disorder.

(3) If the ms sql server jdbc driver provided by Microsoft is used, if there is an image or text type field in the query statement, it must be read in order, otherwise an error such as Driver]ResultSet can not re-read row data for column will be reported.

(4) If you don't want to query whether there are image or text type fields in the statement, you can get them out of order or repeatedly. Then you have to replace the driver and switch to a third party.

Solution:

Download JDTS driver (support SQL6.5, 7.0, 2000, 2005, SYBASE) Download address: jtds.sourceforge.net/

After downloading and extracting, find jtds-1.2.2.jar and put it in the JSP project WEB-INF/lib directory.

Database connection file DbConn.java

package com.database; import java.sql.*; public class DbConn { //private static String driverName ="com.microsoft.jdbc.sqlserver.SQLServerDriver"; //private static String dbURL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=jsp"; //original connection,jsp is database file http://www.dwww.cn private static String driverName ="net.sourceforge.jtds.jdbc.Driver"; private static String dbURL="jdbc:jtds:sqlserver://localhost:1433/jsp"; private String userName="dwww"; private String userPwd="dwww"; public Connection dbConn=null; public synchronized Connection getConnection() { try { Class.forName(driverName).newInstance(); dbConn=DriverManager.getConnection(dbURL, userName, userPwd); if(dbConn!= null) return dbConn; } catch(Exception e) { e.printStackTrace(); return null; } return null; } }

Ok, JSP website development in the driver conflict resolution.

About "how to solve JSP website development in the driver conflict problem" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people 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

Development

Wechat

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

12
Report