重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
1、打开搜索,输入“oracle”,在结果中,找到 【oracle官方网站】点击进入。
创新互联建站是一家集网站建设,麒麟企业网站建设,麒麟品牌网站建设,网站定制,麒麟网站建设报价,网络营销,网络优化,麒麟网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
2、进入“oracle官网”,点击上方菜单栏【downloads】(下载),在下拉菜单中找到【Database】(数据库),然后点击下方【oracle Database】(oracle 数据库)。
3、进入oracle 数据库下载节目,勾选 Accept License Agreement(同意oracle协议)。
4、勾选协议完成,鼠标往下拉找到【Oracle Database 11g Release 2】界面,"在下方选择需要安装oracle的操作系统类型",选择玩吧点击后发的【select All】。
5、进入下载节目,勾选 Accept License Agreement 然后在下方分别下载【win32_11gR2_database_2of1.zip 】【win32_11gR2_database_2of2.zip 】。
6、此时要求我们“登录oracle账户”,如果我们有oracle账户,直接输入账户密码进行登录即可,
没有oracle账户的话,点击右方【创建账户】。
7、进入注册账户界面,按照注册要求,填写相关信息,填写完毕,点击下方【创建】(密码必须是大写字母+小写字母+数字)。
8、创建账户成功,此时会提示我们要求我们进入注册邮箱进行账户验证。
9、此时返回登录界面,输入我们oracle账户密码,进行登录。
10、此时返回下载节目,就可以点击【oracle下载文件】进行下载了,建议在本地路径下,新建一个oracle文件夹,将两个文件“保存到同一目录下即可。
第一个类:
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 ("导出到Excel".equals(str)) {
ExcelDemo demo = new ExcelDemo();
demo.method(data);
} else if ("删除".equals(str)) {
if (data.getRow() != -1) {
data.delRow();
} else {
JOptionPane.showMessageDialog(null, "请选择要删除的行!");
}
}else if("从Excel导入".equals(str)){
data.getXlsInfo();
}else if("从Excel导入到数据库".equals(str)){
data.toDb();
}else if("从table导出到pdf".equals(str)){
TableToPdf pdf=new TableToPdf();
pdf.newPage(data);
}else if("计算学分".equals(str)){
data.getXlsInfoToCredit();
}
}
}
第二个类:数据库连接
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");
// }
}
第三个类:主类(入口)
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");
// }
}
第四个类:
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, "导出完成!");
} 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的数据到表单
*
* @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;
}
}
因为时间问题就没有再写了,上面是我以前做的,不懂就q我
没有中文的,只有英文的,这是官网连接:
上边有zip下的下载连接
12c1
11g2
11g1
也可以在第一个网址中直接点连接查看或下载