简体   繁体   English

org.hibernate.exception.JDBCConnectionException:调用Driver#connect时出错

[英]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.

相关问题 引起原因:org.hibernate.exception.JDBCConnectionException:调用Driver#connect时出错 - Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect failed.org.hibernate.exception.JDBCConnectionException:使用PostGres Hibernate调用Driver#connect时出错 - failed.org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect with PostGres Hibernate 无法创建sessionFactory object.org.hibernate.exception.JDBCConnectionException:调用Driver#connect时出错 - Failed to create sessionFactory object.org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect org.hibernate.exception.JDBCConnectionException:调用DriverManager#getConnection时出错 - org.hibernate.exception.JDBCConnectionException: Error calling DriverManager#getConnection org.hibernate.exception.JDBCConnectionException - org.hibernate.exception.JDBCConnectionException 使用 Hibernate 调用 Driver#connect 时出错 - “Error calling Driver#connect” using Hibernate Hibernate、JDBC:调用 Driver#connect 时出错 - Hibernate, JDBC: Error calling Driver#connect org.hibernate.exception.JDBCConnectionException:无法使用hibernate执行查询 - org.hibernate.exception.JDBCConnectionException: could not execute query using hibernate org.hibernate.exception.JDBCConnectionException:无法在MySQL中打开连接异常 - org.hibernate.exception.JDBCConnectionException: Could not open connection exception in MySQL 如何解决此异常org.hibernate.exception.JDBCConnectionException - How to resolve this exception org.hibernate.exception.JDBCConnectionException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM