In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
What is the method for jsp to connect to the sql database? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!
JSP full name is Java Server Pages, Chinese is called java server page, it is a simplified Servlet design, it is advocated by Sun Microsystems company, many companies participate in the establishment of a dynamic web technology standard. JSP technology is a bit similar to ASP technology, it inserts Java program segments (Scriptlet) and JSP tags (tag) into the traditional web page HTML (a subset of the standard general markup language) file (* .htm, * .html) to form a JSP file with the suffix (* .jsp). Web applications developed with JSP are cross-platform and can run not only under Linux but also on other operating systems.
Jsp connects to the sql database as follows:
The Connection parameter / / this parameter is used to perform the operation of linking the database String parameter 2 = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; / / in a double quotation mark is MicroSoft's SQLServer database driver, which helps you connect to the SQLServer database, so that the application can write SQL statements to obtain, change or add data String parameter 3 = "jdbc:sqlserver://localhost:1433;DatabaseName= database name" / / connection string, format: "jdbc: company name: database driver name: / / database server ip: port number; DatabaseName= database name" String parameter 4 = "sa"; / / the total entry of the database, usually sa String parameter 5 = "password"; / / the password you set try {Class.forName (parameter 2) / / when you start to execute the static initialization code after loading the driver class, you will automatically create a new object of Driver and call DriverManager.registerDriver to register yourself with DriverManager. Parameter = DriverManager.getConnection (parameter 3, parameter 4, parameter 5); / / the critical part is to request} catch (Exception e) {e.printStackTrace (); / / you can also determine whether to connect to the database, and an error will be reported if the connection fails. } Thank you for reading! After reading the above, do you have a general idea of how jsp connects to the sql database? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.