Method analysis of connecting Oracle database with Java
Oracle database first creates a table and adds some data
1. First create a student table in Oracle Database:
2. Add some data to the table
Insert into student values ('1 ',' Wang Xiaojun ',' 1 ',' 17 ',' 102, door 7, building 30, Hepingli District 7, Beijing ')
Writing java code in MyEclipse
1. Add ojdbc6 Import jar into the project
First create a project, and then right-click -- > New -- > folder over the project; folder name:lib; This creates a folder Lib in the project; Then add ojdbc6 The jar package is imported into this folder
The package download address link: http://wd.jb51.net:81//201612/yuanma/ojdbc6_jb51.rar
Move the mouse over the package; Right click -- > build path -- > add to build path;
2. Create a class and start coding
3. Create a test class
As noted in the test class, you can only connect to the Oracle database in the correct way, add, delete, modify and query operations, but the processing mechanism for some error operations is not perfect.
The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. At the same time, I also hope to support a lot of programming tips!