Java Connection database driver code synthesis sharing

Source: Internet
Author: User
Tags db2 informix postgresql sybase sybase database access database

1, oracle8/8i/9i database (thin mode) class.forname ("Oracle.jdbc.driver.OracleDriver"). newinstance (); String url= "Jdbc:oracle:thin: @localhost: 1521:ORCL";//ORCL is the sidstring user= "test" of the database; string password= "Test"; Connection conn= drivermanager.getconnection (Url,user,password), 2, DB2 database Class.forName (" com.ibm.db2.jdbc.app.db2driver  "). newinstance (); String url= "Jdbc:db2://localhost:5000/sample";//sample for your database name string user= "Admin"; String password= ""; Connection conn= drivermanager.getconnection (Url,user,password); 3, sql server7.0/ 2000 Database Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServerDriver"). newinstance (); String url= "Jdbc:microsoft:sqlserver://localhost:1433;databasename=mydb";//mydb for Database string user= "SA"; String password= ""; Connection conn= drivermanager.getconnection (Url,user,password); 4, Sybase database Class.forName (" Com.sybase.jdbc.SybDriver "). newinstance (); String url = " jdbc:sybase:tds:localhost:5007/mydb";//myDB is your database name properties sysprops = system.getproperties (); Sysprops.put ("User", "userid"); Sysprops.put ("Password", "User_password"); Connection conn= drivermanager.getconnection (Url, sysprops); 5, Informix Database Class.forName (" Com.informix.jdbc.IfxDriver "). newinstance (); String url = "Jdbc:informix-sqli://123.45.67.89:1533/mydb:informixserver=myserver;user=testuser; Password=testpassword ";//mydb is the database name connection conn= drivermanager.getconnection (URL); 6, MySQL database class.forname ("Org.gjt.mm.mysql.Driver"). newinstance (); String url = "jdbc:mysql://localhost/mydb?user=soft&password=soft1234&useunicode=true& Characterencoding=8859_1 "//mydb for database name connection conn= drivermanager.getconnection (URL); 7, PostgreSQL database Class.forName ("Org.postgresql.Driver"). newinstance (); string url = "Jdbc:postgresql://localhost/mydb"//mydb for the database name string user= "MyUser"; String password= "MyPassword"; Connection conn= drivermanager.getconnectIon (Url,user,password), 8, Jdbc-odbc bridge class.forname ("Sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=drivermanager.getconnection ("jdbc:odbc:jsp"); JSP is the ODBC data source name established, first set Sql server table as the data source. In the Administrative Tools-Data source ODBC, add the system DNS.  8.oracle8/8i/9i database (thin mode)  //import java.sql.*; class.forname (" Oracle.jdbc.driver.OracleDriver "). newinstance ();  string url=" Jdbc:oracle:thin: @localhost: 1521:ORCL ";  //ORCL for the database sid string user= "test";  string password= "Test";  connection conn = drivermanager.getconnection (Url,user,password);  statement stmtnew=conn.createstatement (); 9. DB2 database  //import java.sql.*; class.forname ("com.ibm.db2.jdbc.app.db2driver "). NewInstance () ;  string url= "Jdbc:db2://localhost:5000/sample";  //sample for your database name  string user= "Admin";  string password= "";  connection conn= drivermanager.getconnection (Url,user,password);  statement stmtnew=conn.createStatement ();  resultset rs = stmt.executqurey (SQL);  /10.sql server7.0/2000 database  //import java.sql.*; class.forname ("Com.microsoft.sqlserver.jdbc.SQLServerDriver"). newinstance ();  //string url= "JDBC:MICROSOFT:SQLSERVER://LOCALHOST:1433;DATABASENAME=DB2";  //7.0, 2000  String url= "JDBC:SQLSERVER://LOCALHOST:1433;DATABASENAME=DB2";  //2005 //db2 is the database name  string  user= "sa";  string password= "";  connection conn= drivermanager.getconnection (URL , User,password);  statement stmtnew=conn.createstatement (); resultset rs =  Stmt.executqurey (SQL);  /11.sybase database  //import java.sql.*; class.forname (" Com.sybase.jdbc.SybDriver "). newinstance ();  string url ="  jdbc:sybase:tds:localhost:5007/ MyDB ";//mydb for your database name  properties sysprops = system.getproperties ();  sysprops.put (" User " , "userid");  sysprops.put ("Password", "User_password ");  connection conn= drivermanager.getconnection (Url, sysprops);  Statement stmtnew=conn.createstatement ();  resultset rs = stmt.executqurey (SQL);  /12.informix database  //import java.sql.*; class.forname ("Com.informix.jdbc.IfxDriver"). Newinstance () ; string url =  "jdbc:informix-sqli://123.45.67.89:1533/mydb:informixserver=myserver;  User=testuser;password=testpassword ";  //mydb for database name  Connection conn=  Drivermanager.getconnection (URL);  statement stmtnew=conn.createstatement ();  ResultSet rs  = stmt.executqurey (SQL);  /13.mysql database  //import java.sql.*; //class.forname (" Org.gjt.mm.mysql.Driver "). newinstance ();  class.forname (" Com.mysql.jdbc.Driver ");  //string url  = "jdbc:mysql://localhost/mydb?user=soft&password=soft1234&useunicode=true&characterencoding= 8859_1 ";  string url =" Jdbc:mysql://localhost:3306/mydb ";//mydb is the database name  connection conn= drivermanager.getconnection (URL," root "," Root ");  statement stmtnew=conn.createstatement (); 14.PostgreSQL database  //import java.sql.*;  class.forname ("Org.postgresql.Driver"). newinstance ();  string url = "jdbc:postgresql:// Localhost/mydb " //mydb for Database name  string user=" MyUser ";  string password=" MyPassword ";  Connection conn= drivermanager.getconnection (Url,user,password);  statement stmtnew= Conn.createstatement (); 15.access database directly with ODBC  //import java.sql.*; class.forname (" Sun.jdbc.odbc.JdbcOdbcDriver ")  ; string url=" jdbc:odbc:driver={microsoft access  driver  (*.mdb)};D bq= "+application.getrealpath ("/data/reportdemo.mdb ");  connection conn =  drivermanager.getconnection (URL, "sa", "" ");  statement stmtnew=conn.createstatement (); 16. Program Timing  long time1=system.currenttimemillis (); &nbsP;long time2=system.currenttimemillis ();  long interval=time2-time1;17. Delay  try {  Thread.Sleep (Integer.parse (%%1));  } catch (interruptedexception e)  { e.printstacktrace ();  }18. Connect Excel file  //import java.sql.*; class.forname ("Sun.jdbc.odbc.JdbcOdbcDriver");  String url =  "jdbc:odbc:driver={microsoft excel driver  (*.xls)};D bq=d:\\ Mydb.xls "; //  does not set the data source  string user=" MyUser ";  string password=" MyPassword ";  Connection conn= drivermanager.getconnection (Url,user,password);  statement stmtnew= Conn.createstatement ();

Process

The first step: demand Research and analysis
1 The relevant system analysts and users to understand the requirements, and then use Word to list the system to develop the large functional modules, each large function module has a small function module, for some needs more clearly related interface, in this step can be a preliminary definition of a small number of interfaces.
2 system analyst in-depth understanding and analysis of requirements, according to their own experience and needs to use Word or related tools to make a document system functional requirements document. This document will be clear examples of the system of large functional modules, large functional modules have small functional modules, and also examples of related interface and interface functions.
3 System analysts and users confirm the requirements again.
Step Two: Outline design
First, the developer needs to design the software system in a brief, i.e. system design. The design of the software system needs to be considered, including the basic processing flow of the system, the structure of the system, the partition of the module, the function allocation, the interface design, the operation design, the data structure design and the error handling design, which provides the basis for the detailed design of the software.
Step Three: Detailed design
Based on the outline design, the developer needs to design the software system in detail. In detail design, describe the main algorithm, data structure, class hierarchy and call relation involved in implementing the concrete module, need to explain the design consideration of each program (each module or subroutine) in each level of software system in order to encode and test. The software needs to be fully distributed to the entire software. Detailed design should be detailed enough to be coded according to detailed design reports.
Fourth step: Encode
In the software coding stage, the developer according to the "Software system detailed design report" in the data structure, the algorithm analysis and the module realization and so on the design request, began the concrete programming work, respectively realizes each module function, thus realizes to the target system function, the performance, the interface, the interface and so on the request.
Fifth Step: Test
Test a well-written system. Given to the user, the user uses the following one to confirm each function.
Sixth step: Software Delivery preparation
After the software test proves that the software meets the requirements, the software developer should submit to the user the product of the contract between the two parties, such as target installation program, database data dictionary, user installation Manual, user Guide, demand report, design report, test report, etc.   The user installation manual should describe in detail the requirements of the installation software for the operating environment, the definition and contents of the installation software, the specific installation steps on the client, server side and middleware, and the system configuration after installation. "User Guide" should include the use of software functions of the process, operating procedures, the corresponding business introduction, special tips and precautions, etc., should also be illustrated when necessary.
Seventh Step: Acceptance
User acceptance.



Mode
Rapid Prototyping Model: (need to quickly create a software prototype that can be run to understand and clarify problems)
The rapid prototyping model allows for a preliminary non-complete analysis and definition of the requirements of the software during the requirements analysis phase, rapidly designing and developing a prototype of the software system (demonstrating all or part of the functionality and performance of the software being developed: The user tests the prototype, gives specific improvements, and enriches the software requirements. Developers to make changes to improve)
Pros: Overcoming the shortcomings of the waterfall model and reducing the development risk due to unclear software requirements: A, the selected development technology and tools do not necessarily conform to the mainstream development B, the rapid establishment of the system plus continuous modification may result in product quality under

Incremental models: (with linear sequences interleaved with the progress of the schedule, each linear Xu Lei generates a published "increment" of the software, and the first increment is often the core product)
In common with other models: it is essentially iterative, just like the prototype implementation model and other evolutionary methods
differs from the prototype implementation model: it emphasizes that each increment publishes an actionable product, (it does not need to wait until all requirements come out, as long as the need to touch the incremental package to develop)
Advantages: 1, the personnel allocation is flexible, at first do not need to invest a large number of human resources 2, when the staff can not complete the product within a limited time, it may provide a way to first launch the core products, can now release some of the functions to the user (sedative effect on the user) 3, incremental management technology risk can be planned
Cons: 1, if there is an intersection between the incremental packages and is not well handled, you must do a comprehensive system analysis
Note: This model will be developed separately after function refinement to adapt to the software development process that needs to change frequently
Prototype Model: (Sample model, refine the prototype using a stepwise refinement method)
Main idea: First borrow the existing system as prototype model, through "sample" continuous improvement, so that the final product is the user needs. Prototype model by providing users with prototypes to obtain feedback from users, so that the development of software can really reflect the needs of users,
Adoption method: The prototype model uses the gradual refinement method to perfect the prototype, so that the prototype can be "fast" development, avoiding the same as waterfall model in the lengthy development process difficult to respond to the user's feedback quickly
Advantages:
(1) The developer and the user agree on the "prototype". In this way, the errors in the design and the risks in the development can be reduced, and the time of user training is reduced, and the practicability, correctness and user satisfaction of the system are improved.
(2) Shorten the development cycle and speed up the progress of the project.  (3) Reduce costs.  Disadvantage: 1, when re-production of the product, it is difficult for users to receive, to continue to carry out the project to bring unfavorable factors. 2, it is not appropriate to use the prototype system as the final product. Using a prototype model development system, users and developers must agree:
Fountain Model: (Based on user demand, object-driven model, mainly used for software development projects using object technology)
It argues that the phases of the software development process are iterative and non-interstitial in each iteration: the parts of the software are often repeated several times, and related objects are added to the progressive software component in each iteration without gaps: it has no apparent boundary between activities (such as analysis and design activities < Due to the application of object concept, expression analysis, design, implementation and other activities only use object class and Relationship >)
Advantages: 1, can improve the software project development efficiency, save development time, adapt to the object-oriented software development process
Inconvenience: 1, because the fountain model in each development phase is overlapping, so in the development process requires a large number of developers, so it is not conducive to project management. 2, this model requires strict management of documents, making the audit more difficult, especially in the face of the possibility of adding a variety of information, needs and information at any time
Helical models: (suitable for projects with frequently changing requirements < suitable for large and complex systems >)
It is mainly risk analysis and evaluation, along the spiral to carry out several iterations, process: 1, make plans: Determine the software objectives, select the implementation plan, understand the constraints of project development 2, Risk analysis: Analysis and evaluation of the selected program, consider how to identify and eliminate risk 3, implementation of the project: implementation of software development and validation; 4. Customer Evaluation: Evaluate the development work, propose the amendment proposal, make the next plan.
Advantages: 1, it is driven by risk, emphasizing the optional scheme and constraints to support the reuse of software, to help the software quality as a special goal into the product development shortcomings: 1, it is difficult to convince users that the results of this method of fireworks can be controlled 2, the construction cycle is long (and software technology development is relatively fast, So often appear after the software development, and the current level of technology there is a big gap, can not meet the needs of current users) 3, unless the software developers are good at looking for possible risks, accurate analysis of risks, otherwise it will bring greater risk
Waterfall Model: (in essence, waterfall model is a software development architecture, repeated application) (the core idea: according to the process to simplify the problem, the function of the implementation and design, easy division of cooperation, the use of structured analysis and design methods to separate the logical implementation and physical implementation, according to the software life cycle from top to bottom, The order of convergence < The fall of the waterfall Flow >)
Disadvantage: 1, in the project at all stages of a very little feedback, the division of each stage is completely fixed, the stage generated a large number of documents, increased the workload 2, users only in the late phase of the project to see the results, increased the risk of development 3, the need for too many mandatory completion dates and milestones to track the stages of each project 4, Loop feedback is generated at each stage (if the information is not overwritten or the problem is found, you must return to the previous stage < even the previous activity > and make the appropriate changes, only when the previous stage is confirmed before the next stage) 5, Early errors may not be discovered until later stages of development, leading to serious consequences.
Advantages: 1, for the project to provide a stage-by-point checkpoint 2, when the completion of a phase, only need to focus on the next Stage 3, can be used in the iterative model of the waterfall model
According to the stage division of Waterfall model, software testing can be divided into unit test, integration test, System test


Java Connection database driver code synthesis sharing

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.