?? hello.java
字號:
package com;
//import com.hp.hpl.jena.ontology.*;
//import com.hp.hpl.jena.rdf.model.ModelFactory;
//import com.hp.hpl.jena.rdf.model.Property;
//import com.hp.hpl.jena.rdf.model.RDFNode;
//import com.hp.hpl.jena.rdf.model.Resource;
//import com.hp.hpl.jena.rdf.model.Statement;
//import com.hp.hpl.jena.rdf.model.StmtIterator;
//import com.hp.hpl.jena.vocabulary.VCARD;
//import java.io.*;
//import java.lang.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
//import java.io.FileInputStream;
//import java.io.File;
//import java.io.IOException;
//import java.util.Iterator;
//import com.hp.hpl.jena.ontology.OntClass;
/*import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.rdf.model.ModelFactory;*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
import java.sql.*;
public class hello {
//static String word="helloword!";
public static void main(String args[]){
String Driver = "com.mysql.jdbc.Driver";//驅動程序
String URL = "jdbc:mysql://localhost:3306/db_owl";//連接的URL
String Username = "root";
String Password = "yhj";
try{
try{
File myFile = new File("D:\\楊惠潔\\privacy.owl");
new FileInputStream(myFile) ;
long i =myFile.length();
String b = myFile.getName();
System.out.println(i);
System.out.println(b);
Class.forName(Driver).newInstance();
Connection con = DriverManager.getConnection(URL,Username,Password);
System.out.println(b);
//String sql= "declare a String;set a = b;insert into tb_fileindex set file_name=a;";
String sql="insert into tb_fileindex(file_name) values('"+b+"');";
//String sql="insert into tb_fileindex(file_name) values('privacy.owl');";
Statement stmt = con.createStatement();
stmt.execute(sql);
// SqlCommand cmd
sql= "select file_id from tb_fileindex where tb_fileindex.file_name ='"+b+"';";
ResultSet result=stmt.executeQuery(sql);
//int id = result.getInt("file_id");
//System.out.println(id);
//sql= "select * from tb_fileindex;";
//ResultSet result = stmt.executeQuery(sql);
while(result.next()){
//System.out.print("name:"+result.getString("file_name")+" ");
System.out.print("file_id:"+result.getString("file_id")+" \n");
}
}
catch(IOException e){
System.out.println("couldn't find the file");
}
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
//System.out.println(word);
//OntModel m = ModelFactory.createOntologyModel();
//.read(new FileInputStream(myFile), "");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -