您好我正在尝试通过以下代码建立从我的 java 到 SQL 工作台的连接——
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setServerName("jdbc:mysql://localhost:XXXX/Recommendation1")
dataSource.setUser("root");
dataSource.setPassword("XXXXXXXX");
dataSource.setDatabaseName("Recommendation1");
JDBCDataModel dataModel = new MySQLJDBCDataModel(dataSource);
我还在我的 lib 目录中包含了 mysql-connector-java-5.0.8-bin.jar 仍然出现以下错误
org.apache.mahout.cf.taste.common.TasteException: java.sql.SQLException: Illegal connection port value 'mysql:'
at org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel.getNumThings(AbstractJDBCDataModel.java:596)
at org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel.getNumItems(AbstractJDBCDataModel.java:552)
at org.apache.mahout.cf.taste.impl.recommender.slopeone.MemoryDiffStorage.<init>(MemoryDiffStorage.java:89)
at org.apache.mahout.cf.taste.impl.recommender.slopeone.SlopeOneRecommender.<init>(SlopeOneRecommender.java:69)
at com.HelloServlet1.doPost(HelloServlet1.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:679)
错误的主要原因是项目的 lib 目录中不包含 mysql-connector-java-5.0.8-bin.jar ,但在这种情况下可能是什么原因
谢谢