Myeclipse10.7 connecting SQL Server database technology

Source: Internet
Author: User

(1) The most annoying thing about learning a database is that you don't know how to connect, don't want VS, we call the database directly using a function in WPF, but in Java we use JDBC technology,

So our approach must be a bit more complicated! Read a lot of blog clear, tried a lot of methods or unsuccessful, finally saw the "Javaweb technical details" suddenly dawned, special to everyone to share!

(2) First look at my Project organization:


The one with the mark is need to prepare, the Lib directory for the jar package on the Web download, manageusers for their own written test program!

(3) If you are ready for the four jar packages in the Lib directory, start the configuration:


Click Project Right--properies---Java Bulid Path-----Libraries---Add JARs---Popup box click on your project-find Lib directory select four jar package OK----in ok!



(4) then configure your SQL Server;

Find SQL Server ConfigurationManager find 1 cleavage See TCP/IP as "disabled" and turn it on as shown below!


(5) Demo Code manageusers (the XML configuration of the servlet is configured)

Package Com.lc.view;import Java.io.ioexception;import Java.io.printwriter;import java.sql.connection;import Java.sql.drivermanager;import Java.sql.preparedstatement;import Java.sql.resultset;import Javax.servlet.servletexception;import Javax.servlet.http.httpservlet;import Javax.servlet.http.httpservletrequest;import Javax.servlet.http.httpservletresponse;public class ManageUsers Extends Httpservlet{public void doget (HttpServletRequest request, httpservletresponse response) throws Servletexception, Ioexception{response.setcontenttype ("Text/html;charset=utf-8"); PrintWriter out = Response.getwriter (); Out.println ("(6) Run as follows:

(7) It has been successful! If you have problems in this area, you are welcome to ask questions and learn together!

In addition, if you encounter a problem connecting to the database Welcome to my collation of some of the error handling methods: http://blog.csdn.net/xlgen157387/article/details/39055085


Finally, I wish you success!



Myeclipse10.7 connecting SQL Server database technology

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.