-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: SessionFactory and my own connections
PostPosted: Wed Sep 24, 2003 12:27 pm 
Newbie

Joined: Wed Sep 24, 2003 12:14 pm
Posts: 16
Location: Brazil
Hi!

I have been providing my own connections to Hibernate and after migrating to 2.03 (I don't know if this is the cause) Hibernate seems to be trying to create a "default" coonection that I could find:

Code:
[size=9]4166 INFO  [main] net.sf.hibernate.connection.DriverManagerConnectionProvider
  - Hibernate connection pool size: 20
4176 INFO  [main] net.sf.hibernate.connection.DriverManagerConnectionProvider
  - using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://localhost:3306/hi
bernate
4176 INFO  [main] net.sf.hibernate.connection.DriverManagerConnectionProvider
  - connection properties: {user=niko, password=, charSet=latin1}
4176 INFO  [main] net.sf.hibernate.impl.SessionFactoryImpl     - Use outer join
fetching: true
4256 WARN  [main] net.sf.hibernate.util.JDBCExceptionReporter     - SQL Error: 1
049, SQLState: S1000
4256 ERROR [main] net.sf.hibernate.util.JDBCExceptionReporter     - General erro
r,  message from server: "Unknown database 'hibernate'"
4266 WARN  [main] net.sf.hibernate.impl.SessionFactoryImpl     - Could not obtai
n connection metadata
java.sql.SQLException: General error,  message from server: "Unknown database 'h
ibernate'"
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1536)
        at com.mysql.jdbc.Connection.<init>(Connection.java:486)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:326)
        at java.sql.DriverManager.getConnection(DriverManager.java:512)
        at java.sql.DriverManager.getConnection(DriverManager.java:140)
        at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnec
tion(DriverManagerConnectionProvider.java:93)
        at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.ja
va:167)
        at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.
java:627)
        at com.powerlogic.jcompany.controle.PlcServletContextListener.inicializa
rFabrica(PlcServletContextListener.java:296)
        at com.powerlogic.jcompany.controle.PlcServletContextListener.registrarS
ervicoPersistencia(PlcServletContextListener.java:254)
        at com.powerlogic.jcompany.controle.PlcServletContextListener.contextIni
tialized(PlcServletContextListener.java:80)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3269)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
598)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:4
97)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:219
0)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
        at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
        at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324[/size])

I'm using Oracle and I don't have any references in my files to MySQL neither "hibernate" database.

Any Help?

Thanks in advance

_________________
Paulo Alvim
Powerlogic - Brazil


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2003 6:29 am 
Senior
Senior

Joined: Tue Sep 23, 2003 8:18 am
Posts: 137
Location: Johannesburg, South Africa
Just a hint, to everyone...when giving a stacktrace of your output...I strongly suggest you edit out you username and passwords to your databases...along with any port references, etc. Same thing for you hibernate.cfg.xml files. Not to mention your database ports. :)

Since we cannot edit our own posts, perhaps the mods could be so kind as to remove them for you.

As for your problem. I haven't used the older versions of Hibernate, so can only speculate. Perhaps it is these three lines in your hibernate.cfg.xml that are incorrect?

Code:
<property name = "connection.driver_class"><!--Insert you Oracle Driver type here--> </property>
<property name = "dialect">net.sf.hibernate.dialect.OracleDialect</property>
<property name = "connection.url"><!--database url--></property>


As I said...just speculating.
Maybe post you hibernate.cfg.xml file - rememberring to edit out your passwords, etc. :)

-G


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2003 12:53 pm 
Newbie

Joined: Wed Sep 24, 2003 12:14 pm
Posts: 16
Location: Brazil
Thanks for the suggestion...

The point is: the password and username aren't from my database! I haven't any references (that I could find) to "MySQL" neither the user and pass. I guess it could be a default used in internal codes(?!).

My app has been running with the following hiberante.cfg.xml (Note that I'm providing my connections - so I don't want Hibernate trying to connect by itself!):

Code:
<hibernate-configuration>
    <!--
    a SessionFactory instance listed as /jndi/name
    <session-factory name="/jndi/name">
    -->
    <session-factory name="/FactoryOne">

        <!-- properties -->
        <property name="show_sql">true</property>
        <property name="jdbc.use_streams_for_binary">true</property>
        <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<!--        <property name="query.imports">cirrus.hibernate.test</property> -->
<!--         <property name="connection.pool_size">2</property> -->
        <property name="statement_cache.size">0</property>
        <property name="jdbc.batch_size">0</property>
        <property name="connection.charSet">latin1</property>
        <property name="use_outer_join">true</property>
        <property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
     
        <!-- mapping files -->
        <mapping resource="com/powerlogic/ecompany/vo/Template.hbm.xml"/>
        <mapping resource="com/powerlogic/ecompany/vo/Aplicacao.hbm.xml"/>
        <mapping resource="com/powerlogic/ecompany/vo/Conteudo.hbm.xml"/>
        <mapping resource="com/powerlogic/ecompany/vo/ConteudoPush.hbm.xml"/>
       ... MANY CLASSES...
        <mapping resource="com/powerlogic/ecompany/vo/Portlet.hbm.xml"/>
        <mapping resource="com/powerlogic/ecompany/vo/PortletSettings.hbm.xml"/>
        <mapping resource="com/powerlogic/ecompany/vo/Documento.hbm.xml"/>
    </session-factory>
</hibernate-configuration>


The first error is:
Code:
2103 DEBUG [HostConfig[localhost]] com.powerlogic.jcompany.controle.PlcServletCo
ntextListener     - ############# Hibernate: Inicializando a Fabrica de Sessoes
4887 ERROR [HostConfig[localhost]] net.sf.hibernate.util.JDBCExceptionReporter
   - General error,  message from server: "Unknown database 'hibernate'"
9543 DEBUG [HostConfig[localhost]] com.powerlogic.jcompany.controle.PlcServletCo
ntextListener     - aplicacao - sessao=net.sf.hibernate.impl.SessionFactoryImpl@
4b1af conexao=jdbc/ecompany3

_________________
Paulo Alvim
Powerlogic - Brazil


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.