Reputation: 4553
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).
After this, I removed the hibernate cfg file, and in HibernatUtil class I inserted the configs by myself using .setProperty. I am using the same configs of the cfg file that I removed, which was working but now using setProperty it isnt.
Netbeans is showing an Hibernate error:
org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
And a SQL Error:
java.sql.SQLException: The syntax of the connection URL 'jdbc:jtds:sybase//ip/nomeDoBanco' is invalid
UPDATE
My HibernateUtil class:
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:
Upvotes: 2
Views: 15841
Reputation: 278
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.
Upvotes: 2
Reputation: 1186
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..
Change your url to
jdbc:sybase:Tds:ip:5000/nomeDoBanco
Upvotes: 2