1、打開搜索,輸入“oracle”,在結(jié)果中,找到?【oracle官方網(wǎng)站】點(diǎn)擊進(jìn)入。
創(chuàng)新互聯(lián)建站是一家集網(wǎng)站建設(shè),麒麟企業(yè)網(wǎng)站建設(shè),麒麟品牌網(wǎng)站建設(shè),網(wǎng)站定制,麒麟網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,麒麟網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
2、進(jìn)入“oracle官網(wǎng)”,點(diǎn)擊上方菜單欄【downloads】(下載),在下拉菜單中找到【Database】(數(shù)據(jù)庫),然后點(diǎn)擊下方【oracle Database】(oracle 數(shù)據(jù)庫)。
3、進(jìn)入oracle 數(shù)據(jù)庫下載節(jié)目,勾選?Accept?License Agreement(同意oracle協(xié)議)。
4、勾選協(xié)議完成,鼠標(biāo)往下拉找到【Oracle Database 11g?Release 2】界面,"在下方選擇需要安裝oracle的操作系統(tǒng)類型",選擇玩吧點(diǎn)擊后發(fā)的【select All】。
5、進(jìn)入下載節(jié)目,勾選?Accept?License Agreement ?然后在下方分別下載【win32_11gR2_database_2of1.zip?】【win32_11gR2_database_2of2.zip?】。
6、此時(shí)要求我們“登錄oracle賬戶”,如果我們有oracle賬戶,直接輸入賬戶密碼進(jìn)行登錄即可,
沒有oracle賬戶的話,點(diǎn)擊右方【創(chuàng)建賬戶】。
7、進(jìn)入注冊(cè)賬戶界面,按照注冊(cè)要求,填寫相關(guān)信息,填寫完畢,點(diǎn)擊下方【創(chuàng)建】(密碼必須是大寫字母+小寫字母+數(shù)字)。
8、創(chuàng)建賬戶成功,此時(shí)會(huì)提示我們要求我們進(jìn)入注冊(cè)郵箱進(jìn)行賬戶驗(yàn)證。
9、此時(shí)返回登錄界面,輸入我們oracle賬戶密碼,進(jìn)行登錄。
10、此時(shí)返回下載節(jié)目,就可以點(diǎn)擊【oracle下載文件】進(jìn)行下載了,建議在本地路徑下,新建一個(gè)oracle文件夾,將兩個(gè)文件“保存到同一目錄下即可。
第一個(gè)類:
package totabel.action;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import topdf.TableToPdf;
import totabel.view.TabelData;
import totabel.xls.ExcelDemo;
public class TableAction implements ActionListener {
TabelData data;
public TableAction(TabelData data) {
this.data = data;
}
public void actionPerformed(ActionEvent e) {
String str = e.getActionCommand();
if ("添加".equals(str)) {
data.addData();
} else if ("導(dǎo)出到Excel".equals(str)) {
ExcelDemo demo = new ExcelDemo();
demo.method(data);
} else if ("刪除".equals(str)) {
if (data.getRow() != -1) {
data.delRow();
} else {
JOptionPane.showMessageDialog(null, "請(qǐng)選擇要?jiǎng)h除的行!");
}
}else if("從Excel導(dǎo)入".equals(str)){
data.getXlsInfo();
}else if("從Excel導(dǎo)入到數(shù)據(jù)庫".equals(str)){
data.toDb();
}else if("從table導(dǎo)出到pdf".equals(str)){
TableToPdf pdf=new TableToPdf();
pdf.newPage(data);
}else if("計(jì)算學(xué)分".equals(str)){
data.getXlsInfoToCredit();
}
}
}
第二個(gè)類:數(shù)據(jù)庫連接
package totabel.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class JdbcConnection {
private static JdbcConnection con;
public static JdbcConnection getCon() {
if (con == null) {
con = new JdbcConnection();
}
return con;
}
public Connection getConnection() {
Connection connection=null;
try {
Class.forName("oracle.jdbc.OracleDriver");
String url = "jdbc:oracle:thin:@127.0.0.1:1521:oracle";
String user = "scott";
String password = "tiger";
connection = DriverManager.getConnection(url, user,
password);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return connection;
}
// public static void main(String[] args) {
// JdbcConnection connection=new JdbcConnection();
// connection.getConnection("asd", "99");
// }
}
第三個(gè)類:主類(入口)
package totabel.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class JdbcConnection {
private static JdbcConnection con;
public static JdbcConnection getCon() {
if (con == null) {
con = new JdbcConnection();
}
return con;
}
public Connection getConnection() {
Connection connection=null;
try {
Class.forName("oracle.jdbc.OracleDriver");
String url = "jdbc:oracle:thin:@127.0.0.1:1521:oracle";
String user = "scott";
String password = "tiger";
connection = DriverManager.getConnection(url, user,
password);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return connection;
}
// public static void main(String[] args) {
// JdbcConnection connection=new JdbcConnection();
// connection.getConnection("asd", "99");
// }
}
第四個(gè)類:
package totabel.xls;
import java.io.File;
import java.io.IOException;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
import totabel.view.TabelData;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
public class ExcelDemo {
/**
*
* @param args
*/
private Vector title = new Vector();
private Vector[] array;
// public static void main(String[] args) {
// ExcelDemo demo = new ExcelDemo();
// demo.getXlsInfo();
//
// }
public void method(TabelData table) {
int row = table.getRowSize();
int column = table.getColumnSize();
WritableWorkbook book = null;
Vector title = table.setTitle();
Object[] str = title.toArray();
try {
book = Workbook.createWorkbook(new File("test.xls"));
WritableSheet sheet = book.createSheet("成績表", 0);
for (int i = 0; i str.length; i++) {
sheet.addCell(new Label(i, 0, (String) str[i]));
}
for (int i = 1; i row + 1; i++) {
for (int j = 1; j column + 1; j++) {
sheet.addCell(new Label(j - 1, i, table.getTableInfo(i - 1,
j - 1)));
}
}
book.write();
JOptionPane.showMessageDialog(null, "導(dǎo)出完成!");
} catch (IOException e) {
e.printStackTrace();
} catch (RowsExceededException e) {
e.printStackTrace();
} catch (WriteException e) {
e.printStackTrace();
} finally {
try {
book.close();
} catch (WriteException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 輸出Excel的數(shù)據(jù)到表單
*
* @return
*/
public Vector getXlsInfo() {
Vector v = new Vector();
jxl.Workbook rwb = null;
int index = 0;
try {
rwb = jxl.Workbook.getWorkbook(new File("test.xls"));
Sheet[] sheet = rwb.getSheets();
for (int i = 0; i sheet.length; i++) {
int rs = sheet[i].getRows();
array = new Vector[rs - 1];
for (int j = 1; j rs; j++) {
Cell[] cell = sheet[i].getRow(j);
Vector info = new Vector();
for (int k = 0; k cell.length; k++) {
info.add(cell[k].getContents());
}
array[index] = info;
index++;
v.add(info);
}
Cell[] titleCell = sheet[i].getRow(0);
for (int j = 0; j titleCell.length; j++) {
title.add(titleCell[j].getContents());
}
}
} catch (BiffException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
rwb.close();
}
return v;
}
public Vector getXlsInfoToCredit() {
Vector v = new Vector();
jxl.Workbook rwb = null;
try {
rwb = jxl.Workbook.getWorkbook(new File("d:/test/信科0821(南遷).xls"));
Sheet[] sheet = rwb.getSheets();
for (int i = 0; i sheet.length; i++) {
int rs = sheet[i].getRows();
array = new Vector[rs - 1];
for (int j = 1; j rs; j++) {
Cell[] cell = sheet[i].getRow(j);
Vector info = new Vector();
for (int k = 0; k cell.length; k++) {
// if(){
Pattern p = Pattern.compile("[0-9]{1,}");
Matcher m = p.matcher(cell[k].getContents());
if (m.matches()) {
int score = Integer.valueOf(cell[k].getContents());
float result = getScore(score);
info.add(result);
} else {
info.add(cell[k].getContents());
}
}
v.add(info);
}
Cell[] titleCell = sheet[i].getRow(0);
for (int j = 0; j titleCell.length; j++) {
title.add(titleCell[j].getContents());
}
}
} catch (BiffException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
rwb.close();
}
return v;
}
public float getScore(int n) {
float score = n;
if (n 60) {
score = 0;
return score;
} else {
if (n = 60 n = 63) {
score = (float) 1.0;
} else if (n = 64 n = 67) {
score = (float) 1.3;
} else if (n = 68 n = 71) {
score = (float) 1.7;
} else if (n = 72 n = 75) {
score = (float) 2.0;
} else if (n = 76 n = 79) {
score = (float) 2.3;
} else if (n = 80 n = 83) {
score = (float) 2.7;
} else if (n = 84 n = 87) {
score = (float) 3.0;
} else if (n = 88 n = 91) {
score = (float) 3.3;
} else if (n = 92 n = 95) {
score = (float) 3.7;
} else if (n = 96 n = 100) {
score = (float) 4.0;
}
return score;
}
}
public Vector getTitle() {
// getXlsInfo();
return title;
}
public Vector[] getArray() {
getXlsInfo();
return array;
}
}
因?yàn)闀r(shí)間問題就沒有再寫了,上面是我以前做的,不懂就q我
沒有中文的,只有英文的,這是官網(wǎng)連接:
上邊有zip下的下載連接
12c1
11g2
11g1
也可以在第一個(gè)網(wǎng)址中直接點(diǎn)連接查看或下載