Some work records on Java and databases in Ubuntu (1)

Source: Internet
Author: User

I want to useProgramGenerate some test data and test which of the following data warehouse projects is suitable for open source databases.

In fact, test data can be generated using a process, but I want to learn Java, so I decided to implement it using a program. In addition, I first uninstalled the Windows system that allows me to entertain as soon as I open my computer. Now it is pure ubuntu.

First, record the Java Configuration:

First you need to download Java, this is a very simple process, the link here: http://www.oracle.com/technetwork/java/javase/downloads/index.html. I have a 64-bit system, so I chose a 64-bit GZ package. After the download, You can decompress the package to any directory. Then you only need to configure these environment variables: vi. bashrc (note that it is in the current user's home directory), and then add the following words at the end of the file:

 
Export java_home =/home/Wings/software/jdk1.7. 0_21export jre_home=$ {Java_home }/Jreexport classpath=.: $ {Java_home}/lib: $ {jre_home }/Libexport path=$ {Java_home}/bin: $ path

Run the following command after saving:

Source. bashrc

Enter Java-version in terminal. if the version information is displayed, the installation is successful. If you are not sure, write Hello, world.

The following is eclipse, which is super simple. Like in windows, This is a green installation-Free Software. Download the GZ package and unzip it to a casual directory. Find this file:Eclipse,Then./Eclipse,PersistenceTermialNoCloseGood.Now.

These After all Installation required Database Now . MySQL Good Installation , Open One Termial , Input :Sudo apt-Get install mysql-Server . Automatic Yes Install , And Install Time Yes Let you Input Root Password , After Settings Yes In MySQL Of Configuration File Modify , No Before What to do , If Really Need To Do What , Google Click There will be many .  

Install After that Yes Set Jdb C Driver Install , Download Address Here : Http://dev.mysql.com/downloads/connector/j/ . Download GZ Package , Cross-platform . Download Good Later Extract To One Arbitrary Directory , In Later Eclipse Programming Only In Build Path Li Join This Jar Package You can. .

AttachedI wroteSimpleConnectionTestCode:

 Import Java. SQL .* ;  Public   Class  Dbconnector {  Static  Connection conn;  Public   Static   Void  Main (string [] ARGs ){  Try  {Class. forname ( "Com. MySQL. JDBC. Driver"); System. Out. println ( "Load MySQL driver success! " );}  Catch  (Exception ERR) {system. Out. Print ( "Load MySQL driver failed! " ); Err. getstacktrace ();}  Try  {Conn = Drivermanager. getconnection ("JDBC: mysql: // localhost: 3306/test", "Wings ", Null  ); System. Out. println ( "Connect success! " );} Catch  (Exception ERR) {system. Out. println ( "Connect failed! " ); Err. getstacktrace ();}}} 

It's not too early to go to bed. I wish you a Happy Children's Day. This experiment will continue in the future, and I will continue to record it. I hope that what I wrote today will be helpful to beginners like me.

PS there is also a pitfall here. After I reinstall the system, I always remind me "there is no file or directory" when I follow the above steps and enter the Java-version ", after the du Niang (not the name of the person) to know the missing package, record: sudo apt-Get install ia32-libs.

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.