import com.hp.hpl.jena.db.*;报错是为什么?这是网上找的代码,运行不了

import java.io.*;
import java.sql.SQLException;
import com.hp.hpl.jena.db.*;
import com.hp.hpl.jena.rdf.model.*;

public class Persistent {

public static final String strDriver = "com.mysql.jdbc.Driver";

public static final String strURL = "jdbc:mysql://localhost:3306/jena"; // localhost的后面要直接写冒号,再写3306;

public static final String strUser = "root";

public static final String strPassword = "root";

public static final String strDB = "MySQL";

public static void main(String[] args){

try {

DBConnection connection = new DBConnection(strURL, strUser, strPassword, strDB); // 创建连接时,第四个参数需要指定所用的数据库类型;也就是说strDB的值应该是“MySQL”

try {

Class.forName("com.mysql.jdbc.Driver");

System.out.println("驱动程序已经安装。");

} catch (ClassNotFoundException e){

System.out.println("ClassNotFoundException, Driver is not available");

}

System.out.println("数据库连接成功。"); // 从此处开始读入一个OWL文件并且存储到数据库中;

ModelMaker maker = ModelFactory.createModelRDBMaker(connection); // 使用数据库连接参数创建一个模型制造器

Model defModel = maker.createModel("Costume");
}
}

 // 创建一个默认模型,命名为Costume,因为我要存入的OWL文件名是Costume         
FileInputStream read = null;    
try{      
    File file = new File("F:/Ontology/first.owl");     
    read = new FileInputStream(file);    
    }catch (FileNotFoundException e){     
        e.printStackTrace();      
        System.out.println("未找到要存储的本体文件,请检查文件地址及名称");    
        }     
System.out.println("已将本体文件转换为字节流文件。");         
InputStreamReader in = null;    
try {      
    in = new InputStreamReader((FileInputStream)read, "UTF-8");    
    } catch (UnsupportedEncodingException e) {     
        e.printStackTrace();      
        System.out.println("不支持上述字符集。");    
        }     
System.out.println("已将字节流文件转换为UTF-8编码。");         
defModel.read(in,null);    
try {      
    in.close();     
    } catch (IOException e){     
        e.printStackTrace();      
        System.out.println("无法关闭字节流文件。");    
        }     System.out.println("已将字节流文件关闭。");         
        defModel.commit();     
        System.out.println("数据转换执行完毕,已将本体文件存入数据库。");    
        try{      
            connection.close();     
            } catch (SQLException e){     
                e.printStackTrace();      
                System.out.println("文件无法关闭。");    
                }    
        } catch (RDFRDBException e){    
            System.out.println("出现异常");    
            }    
        System.out.println("已将本体文件持久化到数据库中");   
        } 

}

jena的版本不对,下载个2.6,或者2.7的试试

因为现在的jar包移到org.apache里面去了,不再是com.hp.hpl,所以要么找到以前老版本的jar包导入,要么改写源码,用Apache里面的类。