Hi,
Thank you for your help.
The dbName property was not correctly set in the ds.xml file. Now it works.
Regards
Announcement
Collapse
No announcement yet.
X
-
Leave a comment:
-
Hi,
Thanks for your quick answer. Luckily my question is more generic.
I would like to configure two different RDBMS using the Isomorphic SQL Datasource but I'm not able to find any specific example either in the quick guide or in the Javadocs.
This is how my server.properties is currently configured.
Code:# -------------- SETTINGS FOR Postgres -------------------- sql.defaultDatabase: PostgreSQL sql.PostgreSQL.driver.serverName: x.x.x.x sql.PostgreSQL.driver.portNumber: 5432 sql.PostgreSQL.driver.databaseName: xxxx sql.PostgreSQL.driver.user: xxx sql.PostgreSQL.driver.password: xxxx # -------------- SETTINGS FOR Vertica -------------------- sql.Vertica.driver.serverName: Embedded in JDBC URL sql.Vertica.database.type: generic sql.Vertica.driver.networkProtocol: tcp sql.Vertica.interface.credentialsInURL: true sql.Vertica.driver.url: jdbc:vertica://x.x.x.x:5433/VMart?user=xxxxx&schema=public sql.Vertica.driver.context: sql.Vertica.driver.databaseName: VMart sql.Vertica.driver.name: java:comp/DefaultDataSource sql.Vertica.interface.type: driverManager sql.Vertica.driver: com.vertica.jdbc.Driver sql.Vertica.driver.autoConfigured: true
Referencing the connection using datasource.dbname is not working therefore I feel that I'm missing something.
Could you please advise?
Thanks.
Leave a comment:
-
SmartGWT is not involved in this, it's purely a JPA issue, and we've never tried to get JPA to do this, so we can't really help.
Note that this is extremely trivial to achieve with our SQL DataSource, which has a lot of other advantages. If you started working with JPA without actually identifying a need that can only be met through JPA, we'd recommend taking a hard look at whether it actually makes sense to use in your project.
Leave a comment:
-
Hi Isomorphic,
I know this is an old post but we have to cover the same requirement right now and we'd like to have an update on the question.
I hope you can help.
Regards.
GI
Leave a comment:
-
I'm trying to do the same thing and I believe you have to use JPA 2.0 to have more than one persistence unit, but that is still not the whole answer. Somewhere I saw advice to create sub-folders under META-INF, one for each persistence unit, each with its own persistence.xml, but that does not compile - maybe it was stale info. I found Isomorphic info here:
http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/docs/JpaIntegration.html
which provides several additions to server.properties and persistence.xml but I'm still having compile issues.
I wish I had more help - for both of us.
Leave a comment:
-
I can't resolve this problem yet.
Could anyone help ?
Simple I want multiple EMF in 1 app.
Regards,
Paata Lominadze
Leave a comment:
-
Multiple DataBase By EMF (Into 1 App.)
Hi team,
I'm trying to use multiple database at the same time. How I can do It ?
My Example
1. server.properties
Code:sql.defaultDatabase: Oracle # These are the settings for use with the Oracle database. # hostname and port where the database server is installed sql.Oracle.driver.serverName: 192.168.1.7 sql.Oracle.driver.portNumber: 1521 sql.Oracle.driver.databaseName: ORCL sql.Oracle.driver.user: info sql.Oracle.driver.password: sa sql.Mysql.database.type: mysql sql.Mysql.database.ansiMode: false sql.Mysql.driver.serverName: 192.168.1.251 sql.Mysql.driver.portNumber: 3306 sql.Mysql.driver.databaseName: asteriskcdrdb sql.Mysql.driver.user: kaxa sql.Mysql.driver.password: kaxa sql.Mysql.driver: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
2. DMI Code (or Servlet):
Code:public void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); EntityManager oracleManager = null; Object transaction = null; EntityManager mysqlManager = null; Object mysqlTransaction = null; try { oracleManager = EMF.getEntityManager(); transaction = EMF.getTransaction(oracleManager); System.out.println("oracleManager = "+oracleManager); System.out.println("transaction = "+transaction); mysqlManager = EMF.getEntityManager("Mysql"); mysqlTransaction = EMF.getTransaction(mysqlManager); System.out.println("mysqlManager = "+mysqlManager); System.out.println("mysqlTransaction = "+mysqlTransaction); } catch (Exception e) { if (transaction != null) { EMF.rollbackTransaction(transaction); } if (mysqlTransaction != null) { EMF.rollbackTransaction(mysqlTransaction); } e.printStackTrace(); out.println(e.toString()); } finally { if (oracleManager != null) { EMF.returnEntityManager(oracleManager); } if (mysqlManager != null) { EMF.returnEntityManager(mysqlManager); } } }
I Can get Oracle (Default Database) Connection without any problem . But for MySQL I got an error like this :
Code:javax.persistence.PersistenceException: Unable to initialize EMF provider: null for configuration 'Mysql' at com.isomorphic.jpa.EMF.initializeProvider(EMF.java:272) at com.isomorphic.jpa.EMF.getProvider(EMF.java:243) at com.isomorphic.jpa.EMF.getEntityManager(EMF.java:129) at com.info08.billing.callcenter.server.servlets.InitAppServlet.processRequest(InitAppServlet.java:238) at com.info08.billing.callcenter.server.servlets.InitAppServlet.doGet(InitAppServlet.java:38) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
3. My Persistence.xml
Code:<?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="ds" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/> <property name="hibernate.connection.username" value="info"/> <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/> <property name="hibernate.connection.password" value="sa"/> <property name="hibernate.connection.url" value="jdbc:oracle:thin:@192.168.1.7:1521:ORCL"/> <property name="hibernate.show_sql" value="false"/> <property name="hibernate.format_sql" value="false"/> </properties> </persistence-unit> <persistence-unit name="ds" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> <property name="hibernate.connection.username" value="kaxa"/> <property name="hibernate.connection.password" value="kaxa"/> <property name="hibernate.connection.url" value="jdbc:mysql://192.168.1.251/asteriskcdrdb"/> <property name="hibernate.show_sql" value="false"/> <property name="hibernate.format_sql" value="false"/> </properties> </persistence-unit> </persistence>
Is this correct if I have same datasource name into xml file ? or If i set different names how I can configure it in server.properties file :
Code:# Name of the datasource jpa.persistenceUnitName: ds
Any idea ???
My Env:
1. OS : Linux OpenSuSe 11.3
2. JDK : 1.7
3. Eclipse
4. Smartgwtee-3.1.d (Eval. 03.01.2012 )
Regards,
Paata Lominadze.Tags: None
Leave a comment: