java.sql.SQLException:无法为jdbc找到合适的驱动程序weka.experiment.DatabaseUtils.connectToDatabase(DatabaseUtils.java:563)

时间:2017-06-08 01:46:12

标签: sql-server jdbc weka

我正在尝试通过weka实验检索实例查询将Weka连接到MS SQL DB并获得以下错误

这里要注意的一件事是我没有为MS SQL数据库实例分配任何默认端口,下面是我的Databaseutil.props文件内容

# database URL
jdbcURL=jdbc:sqlserver://MSSQL\SQLEXPRESS;databaseName=MovieDatabase
# specific data types
string, getString() = 0;    
boolean, getBoolean() = 1;
double, getDouble() = 2;  
byte, getByte() = 3;      
short, getByte()= 4;      
int, getInteger() = 5;    
long, getLong() = 6;      
float, getFloat() = 7;    
date, getDate() = 8;      
text, getString() = 9;    
time, getTime() = 10;     
timestamp, getTime() = 11;

# map SQL Server data type to WEKA data type
# default mappings
varchar=0
float=2
tinyint=3
int=5
# values added manually
string=0
bigint=6
nvarchar=9
decimal=2
bit=1

错误:

  

sql.SQLException:无法为jdbc找到合适的驱动程序:sqlserver:// MSSQL \ sqlexpress:1433; authentication = NotSpecified; authenticationScheme = nativeAuthentication; xopenStates = false; sendTimeAsDatetime = true; trustServerCertificate = false; TransparentNetworkIPResolution = true; serverNameAsACE = FALSE; sendStringParametersAsUnicode = TRUE; selectMethod =直接; responseBuffering =自适应; PACKETSIZE = 8000; multiSubnetFailover = FALSE; loginTimeout = 15; LOCKTIMEOUT = -1; lastUpdateCount = TRUE;加密= FALSE; disableStatementPooling = TRUE;的databaseName = MovieDatabase; columnEncryptionSetting =已禁用; applicationName = SQL Server的Microsoft JDBC驱动程序; applicationIntent = readwrite;
  weka.experiment.DatabaseUtils.connectToDatabase(DatabaseUtils.java:563)
  weka.experiment.InstanceQuery.retrieveInstances(InstanceQuery.java:658)

2 个答案:

答案 0 :(得分:0)

尝试将jdbcDriver属性添加到DatabaseUtils.props文件中:

jdbcDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver

答案 1 :(得分:0)

我在环境中也遇到过同样的问题。从依赖项中删除范围(最初我进行测试)后,它就可以工作。