Originally to do the purpose of data mining in which network, the structure has become a system development.
。
Just still more serious to do for three months, the teacher very much agree with my work attitude and results.
。。
The internship will be over soon. Summarize some of the things that have not been noticed before and become habits and problems and share them with you.
At the same time to make an advertisement: to which network Internal audit department recruit Javaweb Development intern. Time is very free, one day a week, Saturday Sunday and even can, the time of the small friends to give me a message ah, earn an allowance, but also a long experience.
。。。 (GPA, want to work a senior dog is the most suitable only ...
)
In companies, development systems tend to use the development environment. The real environment is only after the system has been developed, talent enough to use online. So how does the database connection be configured?
The answer is to use the. properties file configuration.
Directly on the code:
Dbconfig.properties:
#development Environmentserver_oa = ***port_oa = ***user_oa = ***pass_oa = ***dbname_oa = <span style= "Font-family:ari Al, Helvetica, Sans-serif; >oadb</span> #real Environment#server_oa = <span style= "font-family:arial, Helvetica, Sans-serif;" >***</span> #port_oa = <span style= "font-family:arial, Helvetica, Sans-serif;" >***</span> #user_oa = <span style= "font-family:arial, Helvetica, Sans-serif;" >***</span> #pass_oa = <span style= "font-family:arial, Helvetica, Sans-serif;" >***</span> #dbname_oa = oadb
In the DB Class:
public class DBConnection {public static string server_oa;public static string Port_oa;public static string User_oa;public static string Pass_oa;public static string Dbname_oa;public static string Url_oa;static{try {Properties Properties = new Properties (); InputStream instream = Thread.CurrentThread (). Getcontextclassloader (). getResourceAsStream (" Dbconfig.properties ");p roperties.load (instream), Server_oa = Properties.getproperty (" Server_oa ");p Ort_oa = Properties.getproperty ("Port_oa"), User_oa = Properties.getproperty ("User_oa");p Ass_oa = Properties.getproperty (" Pass_oa ");d Bname_oa = Properties.getproperty (" Dbname_oa "); Url_oa =" jdbc:mysql://"+ Server_oa +": "+ Port_oa +"/"+ DBN ame_oa+ "? user=" + User_oa + "&password=" + Pass_oa;} catch (IOException e) {e.printstacktrace ();}}}
Such You just have to publish your system normally, and the environment changes. Configure the Dbconfig.properties file to do so.
。。。
Where to go net internship Summary: How to configure a database connection (Javaweb)