㈠ 採用java開發商業軟體需要給Oracle付錢嗎
Oracle規定:在"General Purpose Desktop Computers and Servers"上開發和部署Java程序都在該許可證的允許范圍內,不需要給Oracle付費。學習java推薦千鋒教育,該教育機構採用全程面授高品質、高體驗培養模式,擁有國內一體化教學管理及學員服務,助力更多學員實現高薪夢想。
學Java可以從事的工作如下:
1、企業級應用開發大可以做全國聯網的系統,小到中小企業的應用解決方案。多數沒有前端開發的通常是從一個伺服器接收數據,處理後發給另一個處理系統。
2、如今,Java編程已經在金融服務業得到廣泛應用,所有銀行平台的前台和後台電子交易系統、確認和結算服務、數據處理及其他項目都用Java來編寫。
3、服務端程序開發,Java都佔有極為重要的地位。
想要了解更多有關java的相關信息,推薦咨詢千鋒教育。千鋒企合作部整合大量企業客戶資源,緊抓當下企業需求,將技術和項目完美結合千鋒課程體系,力求培養更多優質人才服務企業,不斷提升學員競爭力,鏈接企業用人標準的培訓課程及實戰項目,讓企業招聘用人的技術要求與千鋒學員的技術充分對接。近年來不斷引進阿里釘釘小程序技術、紅帽認證、騰訊雲、亞馬遜等,通過與企業的深度融合實現千鋒教研和就業服務的迭代升級,專業性值得信賴。
㈡ 使用java連接oracle資料庫的詳細步驟,以及怎樣在oracle資料庫里建庫建表,和用戶名及許可權的設置
你按照我以下的步驟就可以建立java跟oracle的鏈接:
(1)首先要安裝oracle資料庫(這是廢話,不過這個過程中你可以設置用戶名機密碼他的許可權相當於管理員),然後啟動查詢分析器再用 great database databasename(數據 庫的名稱)的命令建立資料庫,之後就是要建立資料庫的表,建表的命令如下(我給你的例子是建立一個學生表):
usr database/*你剛才所建立的資料庫的名稱,一定要相同,那麼你就是再這個資料庫中建立了這個表*/
CREATE TABLE stu
(
sno char(10) NOT NULL /*學號欄位*/
CONSTRAINT PK_sno PRIMARY KEY CLUSTERED,/*主鍵約束*/
sname char(8) NOT NULL, /*姓名欄位*/
sex char(2) NULL, /*性別欄位*/
native int NULL, /*籍貫*/
birthday varchar(20) NULL,/*學生出生日期*/
dno char(6) NULL,/*學生所在院系編號(外鍵)*/
spno char(8) NULL,/*專業代碼(外鍵)*/
classno char(4) NULL,/*班級號*/
entime char(4) NULL,/*學生入校時間*/
home varchar(40) NULL,/*學生家庭住址*/
tel varchar(40) NULL/*學生聯系電話*/
)
這樣你的資料庫和相應的表就建成了,如果你需要對資料庫的許可權進行設置那麼就涉及到角色的賦予或者你安裝oracle時需要進行設置的用戶明及密碼,這塊說來就話長啦!如果你只是學習java和資料庫的鏈接,那麼這個可以暫時放一邊,如果你非得想知道那麼你需要系統學習資料庫的知識。我這里就不跟你介紹了。建立完表之後就需要對表插入數據(插入數據可以用java編程,用自己設置的軟體插入數據也可以用資料庫的查詢分析氣用sql語句插入)
(2)這一步也是java跟資料庫鏈接的關鍵,在你安裝了資料庫的那台pc機或者伺服器注冊數據源步驟:進入你電腦的控制面板——管理工具——數據源——系統DNS(選中)——添加(在這裡面有你要添加的數據源添加microsoft DOBC for Orccle,再這里點擊完成後會彈出一個對話框,要你填寫數據源的名稱這個名稱一定要記住,java鏈接程序編程時需要用到這個名稱,還有要填伺服器的名稱,這個名稱需要你的伺服器名稱,如果你是單台pc機實驗,那麼在你資料庫登錄的界面那個伺服器名稱就可以了,然後點擊下去進行必要的設置就可以了),這樣我們對資料庫部分的工作已經完成啦!接下來就是完成java的編程部分。
(3)這里就是java的編程部分,這里我給了你一個我從教材弄來的編好並調試成功的程序(當然這跟你自己建立的資料庫是相關的):
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
class add extends JFrame {
private StudentUI userInterface;
private JButton clearButton, writeButton;
// 載入啟動程序和建立資料庫的地址,遠程和對本機的資料庫載入是不一樣得,這里給你一個對本機資料庫的操作
static final String JDBC_DRIVER = "("oracle.jdbc.driver.OracleDriver";
static final String DATABASE_URL = "oracle.jdbc.driver:剛才叫你記住的那個數據源的名字";
// declare Connection and Statement for accessing
// and querying database
private Connection connection;
private Statement statement;
String sqlString ;
//set up column names
String names[] = { "學 號","姓 名","性 別","年 齡","所 在 系"};
// set up GUI
public Add()
{
super( "Add a record of students" );
initialize(); //connect to database
// create instance of reusable user interface
userInterface = new StudentUI( names ); // four textfields
getContentPane().add( userInterface, BorderLayout.CENTER );
// configure button doTask1 for use in this program
writeButton = userInterface.getDoTask1Button();
writeButton.setText( "保存" );
// register listener to call addRecord when button pressed
writeButton.addActionListener(
// anonymous inner class to handle writeButton event
new ActionListener() {
// call addRecord when button pressed
public void actionPerformed( ActionEvent event )
{
addRecord();
}
} // end anonymous inner class
); // end call to addActionListener
// configure button doTask2 for use in this program
clearButton = userInterface.getDoTask2Button();
clearButton.setText( "清除" );
// register listener to call userInterface clearFields() when button pressed
clearButton.addActionListener(
// anonymous inner class to handle clearButton event
new ActionListener() {
// call userInterface clearFields() when button pressed
public void actionPerformed( ActionEvent event )
{
userInterface.clearFields();
}
} // end anonymous inner class
); // end call to addActionListener
// register window listener to handle window closing event
addWindowListener(
// anonymous inner class to handle windowClosing event
new WindowAdapter() {
// add current record in GUI to file, then close file
public void windowClosing( WindowEvent event )
{
terminate(); //close databse
}
} // end anonymous inner class
); // end call to addWindowListener
setSize( 300, 200 );
setVisible( true );
} // end of constructor
// connect to database
public void initialize()
{
try {
Class.forName( JDBC_DRIVER );
// establish connection to database
connection = DriverManager.getConnection( DATABASE_URL,"sa",null );
// create Statement for querying database
statement = connection.createStatement();
}
catch ( SQLException sqlException ) {
JOptionPane.showMessageDialog( null, sqlException.getMessage(),
"Database Error", JOptionPane.ERROR_MESSAGE );
System.exit( 1 );
}
// detect problems loading database driver
catch ( ClassNotFoundException classNotFound ) {
JOptionPane.showMessageDialog( null, classNotFound.getMessage(),
"Driver Not Found", JOptionPane.ERROR_MESSAGE );
System.exit( 1 );
}
} // end method openFile
// close database
public void terminate()
{
try {
statement.close();
connection.close();
}
// handle exceptions closing statement and connection
catch ( SQLException sqlException ) {
JOptionPane.showMessageDialog( null,
sqlException.getMessage(), "Database Error",
JOptionPane.ERROR_MESSAGE );
System.exit( 1 );
}
} // end method
// add record to file
public void addRecord()
{
String fieldValues[] = userInterface.getFieldValues();
// if sno field value is not empty
if ( ! fieldValues[ StudentUI.SNO ].equals( "" ) ) {
// output values to student
try {
int numberAge = Integer.parseInt(
fieldValues[ StudentUI.SAGE ] );
//define string for sql insert statement
String sqlInsert = "INSERT INTO student " +
"VALUES ('" +
fieldValues[0] + "', '" +
fieldValues[1] +"', '"+
fieldValues[2]+ "', "
+numberAge+",'"+fieldValues[4] + "')";
int result = statement.executeUpdate(sqlInsert);
if (result!=0) {
userInterface.clearFields();
JOptionPane.showMessageDialog( this,
"Inserted sucess!", "Insert Result",
JOptionPane.INFORMATION_MESSAGE );
}
} // end try
// process invalid age number
catch ( NumberFormatException formatException ) {
JOptionPane.showMessageDialog( this,
"Bad age number ", "Invalid Number Format",
JOptionPane.ERROR_MESSAGE );
}
// process exceptions from file output
catch (SQLException ee)
{ System.out.println(ee); }
} //end of if sno field value is not empty
else //if sno field value is empty
JOptionPane.showMessageDialog( this,
"Bad sno number ", "Invalid Number Format",
JOptionPane.ERROR_MESSAGE );
} // end method addRecord
public static void main( String args[] )
{
new AddStudentFrame();
}
} // end AddStudentFrame class
基本就這樣啦!不過那個界面的設計代碼就不給你啦!
㈢ 怎麼用java連接oracle資料庫,需要詳細解釋
1)首先你要有java連接oracle資料庫的驅動類,下載好後導入到工程里
2)代碼:
import java.sql.*;
public class JDBCTest {
/**
* @param args
* @throws ClassNotFoundException
*/
public static void main(String[] args)
throws ClassNotFoundException, SQLException{
//1.准備參數
String ip = "192.168.0.26";
String sid = "tarena";
String port = "1521";
String dbUser = "openlab";
String dbPassword = "open123";
String driver
= "oracle.jdbc.driver.OracleDriver";
//2.構造驅動實例
Class.forName(driver);
//3.創建連接
//連接字元串是固定的形式,oracle的形式:
String url
= "jdbc:oracle:thin:@"
+ ip + ":" + port + ":" + sid;
Connection conn
= DriverManager.getConnection
(url, dbUser, dbPassword);
//4.執行SQL語句
String sql = "select id, password, name from user_sd1104 " +
"where id = 1001 and password = '1234'";
Statement stmt = conn.createStatement();
ResultSet rs
= stmt.executeQuery(sql);//執行sql語句
while(rs.next()){
int id = rs.getInt(1);
String pwd = rs.getString(2);
String name = rs.getString(3);
System.out.println("welcome," + name);
}
rs.close();
stmt.close();
conn.close();
}
}
㈣ Java是什麼,他跟Oracle資料庫有什麼關系
java是一種在國內很流行的語言,屬於SUN公司!2010年被甲骨文公司收購的,也就是你說的ORACLE資料庫的生產商的,ORCLE中文翻譯就有「甲骨文」的意思!就目前來看,兩個產品都屬於一個公司的。
㈤ 學習資料庫ORACLE和編程語言JAVA有關系嗎
可以沒有關系,Oracle是最常用的商業資料庫,很多大型商業系統都使用它,可以通用於各種語言開發的系統。資料庫學習一種其他的都差不多。
Java開發的大型商業系統都使用Oracle,DB2,或Sybase資料庫,但Oracle是最常用的,所以還是有一定聯系的。
總之,學習Oracle不一定會用到Java, 但是學習Java基本會用到Oracle。
㈥ oracle與Java的關系
oracle本身是關系資料庫軟體,java是編程語言,二者之間並沒有任何關聯關系,所處層次也不一樣(一個是應用軟體、一個是編程語言)。
結構化查詢語言SQL是關系資料庫的操作語言同樣也是一門語言,也就是說你要對資料庫(如oracle)進行操作必須通過SQL語言來與資料庫進行交互。
SQL本身與JAVA也沒有關聯關系。
使用JAVA來進行應用程序的開發時,有要進行數據的持久化存儲方面的需求時(即需要使用到資料庫),由於二者之間並沒有關聯關系,所以要使用到JDBC技術,將二者關聯起來,JDBC起到二者之間橋梁的作用,JAVA程序通過JDBC構建SQL語句,將業務需求轉化成SQL語句,通過SQL語句來達到與資料庫交互的作用。
JDBC是java鏈接資料庫的橋梁,而SQL是與資料庫交互的語言。你說SQL,資料庫才聽得懂!
㈦ java中怎麼操作oracle資料庫
實現用java訪問oracle資料庫:
准備工作:
1.下載驅動,打開瀏覽器,搜索oracle資料庫驅動,進入下載頁面下載即可;
2.將驅動導入到項目中。
用java訪問oracle資料庫代碼實現:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
try {
Class.forName("oracle.jdbc.driver.OracleDriver"); //載入驅動
//與資料庫建立連接
try {
String url = "jdbc:oracle:thin:@localhost:1521:orcl";
String user = "scott"; //用戶名
String password = "tiger"; //密碼
conn=DriverManager.getConnection(url,username,password);
} catch (SQLException e) {
e.printStackTrace();
}
} catch (ClassNotFoundException e) {
e.printStackTrace();