Hibernate do MSSQL2008 Error calling Driver#connect

Odpowiedz Nowy wątek
2017-08-03 17:10

Rejestracja: 12 lat temu

Ostatnio: 3 miesiące temu

0

Nie moge dać sobie rady z połącznie hibernata i mssql2008. Uzytkownik istnieje uprawnienia nadane;

Plik konfiguracyjny hibernata:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name ="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
    <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
    <property name="hibernate.connection.url">jdbc:sqlserver://10.103.130.15:1433;databaseName=CAQ_Extrusion;"</property>
    <property name="hibernate.connection.username">xxxxxxxx</property>
    <property name="hibernate.connection.password">xxxxxxx</property>
    <property name ="hibernate.show_sql">true</property>
  </session-factory>
</hibernate-configuration>
Configuration cfg = new Configuration().configure("hibernate.cfg.xml");        

            cfg.addAnnotatedClass(TUserTolerances.class);  
            cfg.addAnnotatedClass(TUserTolerancesEmbeddable.class);  

            StandardServiceRegistryBuilder sb = new StandardServiceRegistryBuilder();
            sb.applySettings(cfg.getProperties());
            StandardServiceRegistry standardServiceRegistry = sb.build();                   
            sessionFactory = cfg.buildSessionFactory(standardServiceRegistry);              
            } catch (Throwable ex) {
                                    System.err.println("Initial SessionFactory creation failed." + ex);
                                    JOptionPane.showMessageDialog(null, "Initial SessionFactory creation failed." + ex, "Error:", JOptionPane.ERROR_MESSAGE);                                   
                                    throw new ExceptionInInitializerError(ex);
                                    }
            }
Initial SessionFactory creation failed.org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
Exception in thread "main" java.lang.ExceptionInInitializerError
    at util.HibernateUtil.<clinit>(HibernateUtil.java:44)
    at DAO.GlobalDOA.getQuery(GlobalDOA.java:14)
    at caqcharacteristicimport.CaqCharacteristicImport.main(CaqCharacteristicImport.java:18)
Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
    at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator$1$1.convert(BasicConnectionCreator.java:122)
    at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:140)
    at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:58)
    at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:75)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:106)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
    at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
    at util.HibernateUtil.<clinit>(HibernateUtil.java:40)
    ... 2 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection string contains a badly formed name or value.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
    at com.microsoft.sqlserver.jdbc.Util.parseUrl(Util.java:445)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.parseAndMergeProperties(SQLServerDriver.java:1026)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1008)
    at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:55)
    ... 15 more
edytowany 1x, ostatnio: Shalom, 2017-08-03 17:22

Pozostało 580 znaków

2017-08-03 17:22
Moderator

Rejestracja: 16 lat temu

Ostatnio: 6 godzin temu

The connection string contains a badly formed name or value.

Której części zdania nie rozumiesz? Masz w connection stringu nadmiarowy cudzysłow.


Masz problem? Pisz na forum, nie do mnie. Nie masz problemów? Kup komputer...
edytowany 2x, ostatnio: Shalom, 2017-08-03 17:24

Pozostało 580 znaków

2017-08-03 18:39

Rejestracja: 12 lat temu

Ostatnio: 3 miesiące temu

0

Ok dzięki, nie doczytałem. Problem był jednak trochę trudniejszy, używałem sposobu autoryzacji dla kont bazodanowych, a konto miałem z autoryzacją windowsową.

edytowany 1x, ostatnio: Eiten, 2017-08-03 19:30

Pozostało 580 znaków

Odpowiedz

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0