[英]org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
I am trying to fix an issue but I couldnt do this. 我正在尝试解决问题,但我无法做到这一点。 I created a JFrame to input some database information (IP, Name, User, Password).
我创建了一个JFrame来输入一些数据库信息(IP,名称,用户,密码)。
After this, I removed the hibernate cfg file, and in HibernatUtil class I inserted the configs by myself using .setProperty. 此后,我删除了休眠cfg文件,并在HibernatUtil类中使用.setProperty自己插入了配置。 I am using the same configs of the cfg file that I removed, which was working but now using setProperty it isnt.
我使用的是与我删除的cfg文件相同的配置,该配置正常运行,但现在使用setProperty却不是。
Netbeans is showing an Hibernate error: Netbeans显示了一个休眠错误:
org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
And a SQL Error: 和一个SQL错误:
java.sql.SQLException: The syntax of the connection URL 'jdbc:jtds:sybase//ip/nomeDoBanco' is invalid
UPDATE UPDATE
My HibernateUtil class: 我的HibernateUtil类:
Configuration cfg = new Configuration();
cfg.setProperty("hibernate.dialect", "org.hibernate.dialect.SybaseDialect");
cfg.setProperty("hibernate.connection.driver_class", "com.sybase.jdbc4.jdbc.SybDriver");
cfg.setProperty("hibernate.connection.url", url);
cfg.setProperty("hibernate.connection.username", username);
cfg.setProperty("hibernate.connection.password", password);
cfg.setProperty("hibernate.show_sql", "true");
cfg.setProperty("hibernate.format_sql", "true");
cfg.addAnnotatedClass(Node.class);
cfg.addAnnotatedClass(Fault.class);
factory = cfg.buildSessionFactory();
I am using these jars: 我正在使用这些罐子:
Are you sure this line is correct ? 您确定这行是正确的吗?
cfg.setProperty("hibernate.connection.driver_class", "net.sourceforge.jtds.jdbc.Driver");
It seems to me that you are setting a driver class not known by your environnement. 在我看来,您正在设置一个您的环境未知的驱动程序类。
Your driver does not seem to be right.. 您的驱动程序似乎不正确。
Refer this... 推荐这个...
#hibernate.dialect org.hibernate.dialect.SybaseDialect
#hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
#hibernate.connection.username sa
#hibernate.connection.password sasasa
#hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb
you should be using the SybDriver.. 您应该使用SybDriver。
Change your url to 将您的网址更改为
jdbc:sybase:Tds:ip:5000/nomeDoBanco
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.