Using the Java API; "No database selected" exception

1,092 views
Skip to first unread message

Douglas Myers-Turnbull

unread,
Oct 23, 2014, 7:04:58 PM10/23/14
to jbiowh-...@googlegroups.com
Hi:

I'd like to use the persistence framework as part of my Java project. Specifically, I want to be able to search for DrugBank drugs using my local MySQL database for jbiowh and to retrieve information (e.g. indications) on these drugs.


In my example, when I call AbstractDefaultTools.openConnection with my username, password, connection URL, and driver, I get:
Internal Exception: java.sql.SQLException: No database selected

I have a configuration XML file (<warehouse>) I used to create the DrugBank tables, but I don't know where to put it.

How do I set this up? I don't see any documentation for how to set up the Java API.

Thanks,
Douglas

Roberto Vera Alvarez

unread,
Oct 24, 2014, 4:27:51 AM10/24/14
to jbiowh-...@googlegroups.com
Hi Douglas,

First, I would like to say that DrugBank is changing their XML schema. Now, it
is in a beta stage.

I'm working to introduce the changes into JBioWH. For the last DrugBank schema
the JBioWH parser and persistence APIs will be ready in a few days.

I'm trying to not modify my persistence classes, I mean, I'm trying to not
modify my relational schema. However, they are eliminating a few fields like
the biotransformation and the version.

These changes are not related with your current problem. However, you should
be ready to some changes in the DrugBank persistence classes.

Could you send me the URL that are you using, please?

Also, the config XML without your user and password.

Other questions:

Are you using just JBioWH database?
It is another Persistence Unit in your project?

Regards,
Roberto

Douglas Myers-Turnbull

unread,
Oct 24, 2014, 12:20:05 PM10/24/14
to jbiowh-...@googlegroups.com
Hi Roberto,

Thanks for the reply.

The connection URI I'm using is: jdbc:mysql://localhost:3306/
The XML is below. I assume it's supposed to be loaded at runtime--where should I put it, and what should it be named?

JBioWH is all I have on this MySQL instance.

<warehouse>
    <name>DrugBank</name>
    <type>DrugBank</type>
    <version>4.1</version>
    <homeurl>http://drugbank.ca</homeurl>
    <releaseDate>10/23/2014</releaseDate>
    <database>jbiowh</database>
    <directory>drugbank</directory>
    <temporal>/tmp</temporal>
    <driver>com.mysql.jdbc.Driver</driver>
    <url>jdbc:mysql://localhost:3306/</url>
    <xsdfiledef></xsdfiledef>
    <verbose>info</verbose>
    <droptables>true</droptables>
    <runlinks>true</runlinks>
</warehouse>

Roberto Vera Alvarez

unread,
Oct 24, 2014, 12:41:42 PM10/24/14
to jbiowh-...@googlegroups.com
Hi Douglas,

I did a test with the same config that you sent me. It works perfectly in my
computer.

Attached you can find my log.

Could you send me your log, please?
Are you using windows or linux?
What java version do you have installed?

Paste the output of your terminal here liker this:

perseo:config> java -jar ~/.m2/repository/org/jbiowh-parser/6.1.1/jbiowh-
parser-6.1.1-jar-with-dependencies.jar -i drugbank-config.xml
INFO [main] 2014-10-24 18:35:14,944 - Setting variables from the XML file
INFO [main] 2014-10-24 18:35:14,952 - OpeningWhich JPA connection to:
INFO [main] 2014-10-24 18:35:14,952 - Driver: com.mysql.jdbc.Driver
INFO [main] 2014-10-24 18:35:14,952 - URL:
jdbc:mysql://localhost:3306/jbiowh
INFO [main] 2014-10-24 18:35:14,952 - User: root
INFO [main] 2014-10-24 18:35:14,952 - Adding the WHDBMSFactory to the Map
INFO [main] 2014-10-24 18:35:17,492 - Open EntityManagerFactory:
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl@7bdb4020
INFO [main] 2014-10-24 18:35:17,499 - Parsing a DrugBank data source
INFO [Thread-0] 2014-10-24 18:35:19,160 - JPA Check: 2014/10/24 18:35:19
message: connection OK
INFO [main] 2014-10-24 18:35:19,172 - DataSet: DrugBank is inserted with
WID = 1
INFO [main] 2014-10-24 18:35:19,177 - Global WID = 1152566
INFO [main] 2014-10-24 18:35:19,179 - Creating the Parser files factory
INFO [main] 2014-10-24 18:35:19,179 - Creating file: DrugBank.tsv
INFO [main] 2014-10-24 18:35:19,179 - Creating file:
DrugBank_has_DrugBankCategory.tsv
INFO [main] 2014-10-24 18:35:19,180 - Creating file:
DrugBank_has_DrugBankPatent.tsv
INFO [main] 2014-10-24 18:35:19,180 - Creating file:
DrugBankAffectedOrganism.tsvperseo:config> java -jar
~/.m2/repository/org/jbiowh-parser/6.1.1/jbiowh-parser-6.1.1-jar-with-
dependencies.jar -i drugbank-config.xml
INFO [main] 2014-10-24 18:35:14,944 - Setting variables from the XML file
INFO [main] 2014-10-24 18:35:14,952 - Opening JPA connection to:
INFO [main] 2014-10-24 18:35:14,952 - Driver: com.mysql.jdbc.Driver
INFO [main] 2014-10-24 18:35:14,952 - URL:
jdbc:mysql://localhost:3306/jbiowh
INFO [main] 2014-10-24 18:35:14,952 - User: root
INFO [main] 2014-10-24 18:35:14,952 - Adding the WHDBMSFactory to the Map
INFO [main] 2014-10-24 18:35:17,492 - Open EntityManagerFactory:
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl@7bdb4020
INFO [main] 2014-10-24 18:35:17,499 - Parsing a DrugBank data source
INFO [Thread-0] 2014-10-24 18:35:19,160 - JPA Check: 2014/10/24 18:35:19
message: connection OK
INFO [main] 2014-10-24 18:35:19,172 - DataSet: DrugBank is inserted with
WID = 1
INFO [main] 2014-10-24 18:35:19,177 - Global WID = 1152566
INFO [main] 2014-10-24 18:35:19,179 - Creating the Parser files factory
INFO [main] 2014-10-24 18:35:19,179 - Creating file: DrugBank.tsv
INFO [main] 2014-10-24 18:35:19,179 - Creating file:
DrugBank_has_DrugBankCategory.tsv
INFO [main] 2014-10-24 18:35:19,180 - Creating file:
DrugBank_has_DrugBankPatent.tsv
INFO [main] 2014-10-24 18:35:19,180 - Creating file:
DrugBankAffectedOrganism.tsv



Regards,
Roberto.



On Friday, October 24, 2014 09:20:04 AM Douglas Myers-Turnbull wrote:
> Hi Roberto,
>
> Thanks for the reply.
>
> The connection URI I'm using is: jdbc:mysql://localhost:3306/
> The XML is below. I assume it's supposed to be loaded at runtime--where
> should I put it, and what should it be named?
>
> JBioWH is all I have on this MySQL instance.
>
> <warehouse>
> <name>DrugBank</name>
> <type>DrugBank</type>
> <version>4.1</version>
> <homeurl>http://drugbank.ca</homeurl>
> <releaseDate>10/23/2014</releaseDate>
> <database>jbiowh</database>
> <directory>drugbank</directory>
> <temporal>/tmp</temporal>
> <driver>com.mysql.jdbc.Driver</driver>
> <url>jdbc:mysql://localhost:3306/</url>
> <xsdfiledef></xsdfiledef>
> <verbose>info</verbose>
> <droptables>true</droptables>
> <runlinks>true</runlinks>perseo:config> java -jar
~/.m2/repository/org/jbiowh-parser/6.1.1/jbiowh-parser-6.1.1-jar-with-
dependencies.jar -i drugbank-config.xml
INFO [main] 2014-10-24 18:31:21,335 - Setting variables from the XML file
INFO [main] 2014-10-24 18:31:21,343 - Opening JPA connection to:
INFO [main] 2014-10-24 18:31:21,343 - Driver: com.mysql.jdbc.Driver
INFO [main] 2014-10-24 18:31:21,343 - URL:
jdbc:mysql://localhost:3306/jbiowh
INFO [main] 2014-10-24 18:31:21,343 - User: root
INFO [main] 2014-10-24 18:31:21,343 - Adding the WHDBMSFactory to the Map
INFO [main] 2014-10-24 18:31:23,745 - Open EntityManagerFactory:
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl@774f3466
INFO [main] 2014-10-24 18:31:23,751 - Parsing a DrugBank data source
INFO [main] 2014-10-24 18:31:25,718 - Inserting DataSet: DrugBank with WID
= 1
jbiowh-loader.log

Douglas Myers-Turnbull

unread,
Oct 24, 2014, 3:32:13 PM10/24/14
to jbiowh-...@googlegroups.com
Hi Roberto,

I can run the executable JARs (e.g. jbiowh-parser.jar) without issue. I'm asking how to use JBioWH inside my Java project.


My question is: how can I configure JBioWH as a dependency from within my Java project?

Here's what I'm currently using to initialize JBioWH:

public static void initDrugBankJbiowh(File drugBankXmlConfigFile) {
        try {
            DataSetPersistence.getInstance().readDatasetFromFile(drugBankXmlConfigFile);
        } catch (ParserConfigurationException | SAXException | IOException | SQLException e) {
            throw new RuntimeException("Couldn't initialize JBioWH for DrugBank", e);
        }
        JBioWHUserData factory = JBioWHPersistence.getInstance().getWhdbmsFactory();
        JBioWHDBMSSingleton.getInstance().setWhdbmsFactory(new WHMySQL(factory.getDriver(), factory.getUrl(), factory.getUser(), factory.getPasswd(), true));
        JBioWHDBMSSingleton.getInstance().setMainURL(factory.getUrl());

        DataSetPersistence.getInstance().getDataset().setApplication("DrugLoader");
        DataSetPersistence.getInstance().getDataset().setApplicationVersion("1.0");
}


However, now I'm getting:

  Exception in thread "main" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Syntax error parsing [SELECT g FROM DrugBank g  WHERE ]. 
[25, 31] The conditional expression is missing from the WHERE clause.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1605)
at org.jbiowhpersistence.utils.search.SearchFactory.search(SearchFactory.java:88)
at org.pharmgkb.genome.demo.DemoJbiowDrugBank.getDrugs(DemoJbiowDrugBank.java:82)
at org.pharmgkb.genome.demo.DemoJbiowDrugBank.main(DemoJbiowDrugBank.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Syntax error parsing [SELECT g FROM DrugBank g  WHERE ]. 
[25, 31] The conditional expression is missing from the WHERE clause.
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:155)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:334)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:278)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:163)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:142)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:116)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:102)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:86)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1603)
... 8 more

Thanks.

Roberto Vera Alvarez

unread,
Oct 24, 2014, 4:20:15 PM10/24/14
to jbiowh-...@googlegroups.com
Hi Douglas,

I see the problem now.

I recommend you have a look at this code:

https://code.google.com/p/jbiowh/source/browse/jbiowh-webservices/src/main/java/org/jbiowh/webservices/utils/JBioWHWebservicesSingleton.java

This is the way that I use the persistence in external projects. Try to adapt
it to your own project.

Let me know if I can help you with this code.

Regards,
Roberto
> 2) at

Douglas Myers–Turnbull

unread,
Oct 24, 2014, 8:17:12 PM10/24/14
to jbiowh-...@googlegroups.com
Thanks.

I got it working using that example, though I had to change this line:
 NodeList nodes = document.getElementsByTagName("webservice");
To this:
 NodeList nodes = document.getElementsByTagName("warehouse");

I downloaded the 6.1.1 JARs, ran the warehouse-6.1.0-to-6.1.1.sql script, and ran:
java -jar jbiowh-parser-6.1.1-jar-with-dependencies.jar -i drugbank_config.xml

However, when I tried using SearchDrugBank.search(searchParameters, null) to search for a drug, I got this: 

Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Value ' 1000847 26 days 242138-07-4 biotech� 0�A recombinant DNA-derived humanized IgG1k monoclonal antibody that selectively binds to human immunoglobulin E (IgE). Xolair is produced by a Chinese hamster ovary cell suspension culture in a nutrient medium containing the antibiotic gentamicin.� DB00043+For treatment of asthma caused by allergies�Xolair binds to IgE (a class of antibodies normally secreted in allergic responses), which prevents their binding to mast cells and basophils.
Omalizumab�$ Xolair inhibits the binding of IgE to the high-affinity IgE receptor (FceRI) on the surface of mast cells and basophils. Reduction in surface-bound IgE on FceRI-bearing cells limits the degree of release of mediators of the allergic response. Xolair is used to treat severe, persisten asthma.�Liver elimination of IgG includes degradation in the liver reticuloendothelial system (RES) and endothelial cells. Intact IgG is also excreted in bile. * 78 ± 32 mL/kg��
2014-01-22 0000-00-00 00:00:00�' can not be represented as java.sql.Timestamp
Error Code: 0
Call: SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Indication LIKE ?
bind => [1 parameter bound]
Query: ReadAllQuery(referenceClass=DrugBank sql="SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Indication LIKE ?")
at org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImpl.java:378)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:260)
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:469)
at org.jbiowhpersistence.utils.search.SearchFactory.search(SearchFactory.java:94)
at org.pharmgkb.genome.demo.JBioWHWebservicesSingleton.getDrugs(JBioWHWebservicesSingleton.java:87)
at org.pharmgkb.genome.demo.JBioWHWebservicesSingleton.main(JBioWHWebservicesSingleton.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Value ' 1000847 26 days 242138-07-4 biotech� 0�A recombinant DNA-derived humanized IgG1k monoclonal antibody that selectively binds to human immunoglobulin E (IgE). Xolair is produced by a Chinese hamster ovary cell suspension culture in a nutrient medium containing the antibiotic gentamicin.� DB00043+For treatment of asthma caused by allergies�Xolair binds to IgE (a class of antibodies normally secreted in allergic responses), which prevents their binding to mast cells and basophils.
Omalizumab�$ Xolair inhibits the binding of IgE to the high-affinity IgE receptor (FceRI) on the surface of mast cells and basophils. Reduction in surface-bound IgE on FceRI-bearing cells limits the degree of release of mediators of the allergic response. Xolair is used to treat severe, persisten asthma.�Liver elimination of IgG includes degradation in the liver reticuloendothelial system (RES) and endothelial cells. Intact IgG is also excreted in bile. * 78 ± 32 mL/kg��
2014-01-22 0000-00-00 00:00:00�' can not be represented as java.sql.Timestamp
Error Code: 0
Call: SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Indication LIKE ?
bind => [1 parameter bound]
Query: ReadAllQuery(referenceClass=DrugBank sql="SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Indication LIKE ?")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:331)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.getObject(DatabaseAccessor.java:1329)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.fetchRow(DatabaseAccessor.java:1075)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processResultSet(DatabaseAccessor.java:768)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:655)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2002)
at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:299)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:694)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2738)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2691)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:495)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1168)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1127)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1215)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1751)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:258)
... 9 more
Caused by: java.sql.SQLException: Value ' 1000847 26 days 242138-07-4 biotech� 0�A recombinant DNA-derived humanized IgG1k monoclonal antibody that selectively binds to human immunoglobulin E (IgE). Xolair is produced by a Chinese hamster ovary cell suspension culture in a nutrient medium containing the antibiotic gentamicin.� DB00043+For treatment of asthma caused by allergies�Xolair binds to IgE (a class of antibodies normally secreted in allergic responses), which prevents their binding to mast cells and basophils.
Omalizumab�$ Xolair inhibits the binding of IgE to the high-affinity IgE receptor (FceRI) on the surface of mast cells and basophils. Reduction in surface-bound IgE on FceRI-bearing cells limits the degree of release of mediators of the allergic response. Xolair is used to treat severe, persisten asthma.�Liver elimination of IgG includes degradation in the liver reticuloendothelial system (RES) and endothelial cells. Intact IgG is also excreted in bile. * 78 ± 32 mL/kg��
2014-01-22 0000-00-00 00:00:00�' can not be represented as java.sql.Timestamp
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870)
at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:928)
at com.mysql.jdbc.BufferRow.getTimestampFast(BufferRow.java:555)
at com.mysql.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:5943)
at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:5609)
at com.mysql.jdbc.ResultSetImpl.getObject(ResultSetImpl.java:4582)
at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getObjectFromResultSet(DatabasePlatform.java:1344)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.getObject(DatabaseAccessor.java:1300)
... 32 more


--
You received this message because you are subscribed to a topic in the Google Groups "jbiowh-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jbiowh-discuss/qSJTZmZ3ANg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jbiowh-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roberto Vera Alvarez

unread,
Oct 27, 2014, 10:28:15 AM10/27/14
to jbiowh-...@googlegroups.com
Hi Douglas,

Are you working on Linux or Windows?

Which java version do you have installed?

Regards,
Roberto
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62
> ) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:43) at java.lang.reflect.Method.invoke(Method.java:483)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
> Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services -
> org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseEx
> ception.java:331) at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.getObject(D
> atabaseAccessor.java:1329) at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.fetchRow(Da
> tabaseAccessor.java:1075) at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processResu
> ltSet(DatabaseAccessor.java:768) at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecut
> eCall(DatabaseAccessor.java:655) at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall
> (DatabaseAccessor.java:558) at
> org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(A
> bstractSession.java:2002) at
> org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSess
> ion.java:570) at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.execut
> eCall(DatasourceCallQueryMechanism.java:242) at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.execut
> eCall(DatasourceCallQueryMechanism.java:228) at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.execut
> eSelectCall(DatasourceCallQueryMechanism.java:299) at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.select
> AllRows(DatasourceCallQueryMechanism.java:694) at
> org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllR
> owsFromTable(ExpressionQueryMechanism.java:2738) at
> org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllR
> ows(ExpressionQueryMechanism.java:2691) at
> org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(Rea
> dAllQuery.java:495) at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(Ob
> jectLevelReadQuery.java:1168) at
> org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899
> ) at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelRead

Roberto Vera Alvarez

unread,
Oct 27, 2014, 1:46:51 PM10/27/14
to jbiowh-...@googlegroups.com
Hi Douglas,

I found the problem. It was in the new version of the DrugBank parser. Please,
download the JAR files and insert the database again.

Attached you can find a Maven project with a simple example to search over the
DrugBank module.

Let me know if you need more help.

Regards,
Roberto

On Friday, October 24, 2014 05:16:39 PM Douglas Myers–Turnbull wrote:
> org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImp
> l.java:378) at
> org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.ja
> va:260) at
> org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:
> 469) at
> org.jbiowhpersistence.utils.search.SearchFactory.search(SearchFactory.java:9
> 4) at
> org.pharmgkb.genome.demo.JBioWHWebservicesSingleton.getDrugs(JBioWHWebservic
> esSingleton.java:87) at
> org.pharmgkb.genome.demo.JBioWHWebservicesSingleton.main(JBioWHWebservicesSi
> ngleton.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62
> ) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:43) at java.lang.reflect.Method.invoke(Method.java:483)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
> Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services -
> Query.java:1127) at
> org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403)
> at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(Obj
> ectLevelReadQuery.java:1215) at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuer
> y(UnitOfWorkImpl.java:2896) at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstr
> actSession.java:1804) at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstr
> actSession.java:1786) at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstr
> actSession.java:1751) at
> org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.ja
> org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getObjectFr
> omResultSet(DatabasePlatform.java:1344) at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.getObject(D
> > org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(Herm
> > es>
> > > Parser.java:155) at
> >
> > org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesPars
> > er>
> > > .java:334) at
> >
> > org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(He
> > rm>
> > > esParser.java:278) at
> >
> > org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesPa
> > rs>
> > > er.java:163) at
> >
> > org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(
> > EJ>
> > > BQueryImpl.java:142) at
> >
> > org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(
> > EJ>
DrugBankSearch.tar.gz

Douglas Myers-Turnbull

unread,
Oct 27, 2014, 4:58:36 PM10/27/14
to jbiowh-...@googlegroups.com
Thanks. I now have a better sense of how to set this up.

However, when I ran your example, I got:

 INFO [main] 2014-10-27 13:51:27,553 - Parsing by drug id
   INFO [main] 2014-10-27 13:51:27,554 - Using query: DB08865
   INFO [main] 2014-10-27 13:51:27,759 - HV000001: Hibernate Validator 4.3.2.Final
  Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No database selected
Error Code: 1046
Call: SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?
bind => [1 parameter bound]
Query: ReadAllQuery(referenceClass=DrugBank sql="SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?")
at org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImpl.java:378)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:260)
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:469)
at org.jbiowhpersistence.utils.search.SearchFactory.search(SearchFactory.java:94)
at org.jbiowhpersistence.datasets.drug.drugbank.search.SearchDrugBank.search(SearchDrugBank.java:85)
at org.pharmgkb.genome.demo.DemoDrugBankSearch.run(DemoDrugBankSearch.java:41)
at org.pharmgkb.genome.demo.DemoDrugBankSearch.main(DemoDrugBankSearch.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No database selected
Error Code: 1046

I'm running MySQL 5.6.21 and Java 1.8.0_11 on Mac OX 10.9.5, though I'd guess that MySQL is the issue here.

Roberto Vera Alvarez

unread,
Oct 27, 2014, 5:25:57 PM10/27/14
to jbiowh-...@googlegroups.com
Hi Douglas,

I think that the problem is with the Java version and dependencies.

Please, try to install Oracle Java SE 7u71 from here:

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Also, I see some logs about Hibernate and I'm using EclipseLink. That's way
the persistence layer is not working.

Try to use a maven POM like the one that I sent. Maven will download the
dependencies correctly.

Maybe with the correct Persistence library (EclipseLink) the Java 8 works. I
haven't test it yet.

Regards,
Roberto

On Monday, October 27, 2014 01:58:36 PM Douglas Myers-Turnbull wrote:
> Thanks. I now have a better sense of how to set this up.
>
> However, when I ran your example, I got:
>
> INFO [main] 2014-10-27 13:51:27,553 - Parsing by drug id
> INFO [main] 2014-10-27 13:51:27,554 - Using query: DB08865
> INFO [main] 2014-10-27 13:51:27,759 - HV000001: Hibernate Validator
> 4.3.2.Final
> Exception in thread "main" javax.persistence.PersistenceException:
> Exception [EclipseLink-4002] (Eclipse Persistence Services -
> 2.5.2.v20140319-9ad6abd):
> org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception: java.sql.SQLException: No database selected
> Error Code: 1046
> Call: SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID,
> Description, HalfLife, Id, Indication, MechanismOfAction, Name,
> Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity,
> Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?
> bind => [1 parameter bound]
> Query: ReadAllQuery(referenceClass=DrugBank sql="SELECT WID, Absorption,
> CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id,
> Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding,
> RouteOfElimination, SynthesisRef, Toxicity, Type, Updated,
> VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?")
> at
> org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImp
> l.java:378) at
> org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.ja
> va:260) at
> org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org</groupId>
<artifactId>jbiowh-core</artifactId>
<version>6.1.1</version>
</dependency>
<dependency>
<groupId>org</groupId>
<artifactId>jbiowh-dbms</artifactId>
<version>6.1.1</version>
</dependency>
<dependency>
<groupId>org</groupId>
<artifactId>jbiowh-persistence</artifactId>
<version>6.1.1</version>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>4.7</version>
</dependency>
</dependencies>

> 469) at
> org.jbiowhpersistence.utils.search.SearchFactory.search(SearchFactory.java:9
> 4) at
> org.jbiowhpersistence.datasets.drug.drugbank.search.SearchDrugBank.search(Se
> archDrugBank.java:85) at
> org.pharmgkb.genome.demo.DemoDrugBankSearch.run(DemoDrugBankSearch.java:41)
> at
> org.pharmgkb.genome.demo.DemoDrugBankSearch.main(DemoDrugBankSearch.java:62)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62
> ) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:43) at java.lang.reflect.Method.invoke(Method.java:483)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
> Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services -
> 2.5.2.v20140319-9ad6abd):
> org.eclipse.persistence.exceptions.DatabaseException
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> > pl>
> > > .java:43) at java.lang.reflect.Method.invoke(Method.java:483)
> > > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
> > > Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services -
> > org.eclipse.persistence.exceptions.DatabaseException.sqlException(Database
> > Ex>
> > > ception.java:331) at
> >
> > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.getObject
> > (D>
> > > atabaseAccessor.java:1329) at
> >
> > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.fetchRow(
> > Da>
> > > tabaseAccessor.java:1075) at
> >
> > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processRe
> > su>
> > > ltSet(DatabaseAccessor.java:768) at
> >
> > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExec
> > ut>
> > > eCall(DatabaseAccessor.java:655) at
> >
> > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCa
> > ll>
> > > (DatabaseAccessor.java:558) at
> >
> > org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall
> > (A>
> > > bstractSession.java:2002) at
> >
> > org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSe
> > ss>
> > > ion.java:570) at
> >
> > org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.exec
> > ut>
> > > eCall(DatasourceCallQueryMechanism.java:242) at
> >
> > org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.exec
> > ut>
> > > eCall(DatasourceCallQueryMechanism.java:228) at
> >
> > org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.exec
> > ut>
> > > eSelectCall(DatasourceCallQueryMechanism.java:299) at
> >
> > org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.sele
> > ct>
> > > AllRows(DatasourceCallQueryMechanism.java:694) at
> >
> > org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAl
> > lR>
> > > owsFromTable(ExpressionQueryMechanism.java:2738) at
> >
> > org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAl
> > lR>
> > > ows(ExpressionQueryMechanism.java:2691) at
> >
> > org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(R
> > ea>
> > > dAllQuery.java:495) at
> >
> > org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(
> > Ob>
> > > jectLevelReadQuery.java:1168) at
> >
> > org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:8
> > 99>
> > > ) at
> >
> > org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelRe
> > ad>
> > > Query.java:1127) at
> >
> > org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403
> > )
> >
> > > at
> >
> > org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(O
> > bj>
> > > ectLevelReadQuery.java:1215) at
> >
> > org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQu
> > er>
> > > y(UnitOfWorkImpl.java:2896) at
> >
> > org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abs
> > tr>
> > > actSession.java:1804) at
> >
> > org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abs
> > tr>
> > > actSession.java:1786) at
> >
> > org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abs
> > tr>
> > > actSession.java:1751) at
> >
> > org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.
> > ja>
> > <javascript:>>
> > https://groups.google.com/d/topic/jbiowh-discuss/qSJTZmZ3ANg/unsubscribe.
> >
> > > > To unsubscribe from this group and all its topics, send an email to
> > > > jbiowh-discus...@googlegroups.com <javascript:>.

Douglas Myers-Turnbull

unread,
Oct 27, 2014, 5:44:19 PM10/27/14
to jbiowh-...@googlegroups.com
Thanks.

I just tried using Java 7u71 as well. I'm using exactly your example (I'm not integrating it into another project).

Here are the exact steps I performed and their output:

>java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

>javac -version
javac 1.7.0_71

>mvn install
.    .    .
.    .    .
.    .    .
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.143 s
[INFO] Finished at: 2014-10-27T14:38:04-07:00
[INFO] Final Memory: 38M/433M
[INFO] ------------------------------------------------------------------------


>java -jar target/DrugBankSearch-0.0.1-jar-with-dependencies.jar --user jbiowh --passwd jbiowh --url jdbc:mysql://localhost:3306/ -q DB08865

 INFO [main] 2014-10-27 14:38:14,791 - Parsing by drug id
   INFO [main] 2014-10-27 14:38:14,798 - Using query: DB08865
  Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No database selected
Error Code: 1046
Call: SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?
bind => [1 parameter bound]
Query: ReadAllQuery(referenceClass=DrugBank sql="SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?")
at org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImpl.java:378)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:260)
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:469)
at org.jbiowhpersistence.utils.search.SearchFactory.search(SearchFactory.java:94)
at org.jbiowhpersistence.datasets.drug.drugbank.search.SearchDrugBank.search(SearchDrugBank.java:85)
at org.drugbanksearch.Main.run(Main.java:40)
at org.drugbanksearch.Main.main(Main.java:61)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No database selected
Error Code: 1046
Call: SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?
bind => [1 parameter bound]
Query: ReadAllQuery(referenceClass=DrugBank sql="SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id, Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity, Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:682)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2002)
at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:299)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:694)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2738)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2691)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:495)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1168)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1127)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1215)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1751)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:258)
... 5 more
Caused by: java.sql.SQLException: No database selected
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2030)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:1007)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:642)
... 25 more

Douglas Myers-Turnbull

unread,
Oct 27, 2014, 6:02:13 PM10/27/14
to jbiowh-...@googlegroups.com
Hi Roberto,

Sorry, I wasn't specifying my database in the URL! That should have been obvious.

The example is indeed working. Thanks for your help.

Regards,
Douglas
...

Roberto Vera Alvarez

unread,
Oct 27, 2014, 6:03:14 PM10/27/14
to jbiowh-...@googlegroups.com
Hi Douglas,

The URL is not complete. You are missing the database name. In my case is:

--url jdbc:mysql://localhost:3306/biowh

Regards,
Roberto

On Monday, October 27, 2014 02:44:19 PM Douglas Myers-Turnbull wrote:
> Thanks.
>
> org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImp
> l.java:378) at
> org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.ja
> va:260) at
> org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:
> 469) at
> org.jbiowhpersistence.utils.search.SearchFactory.search(SearchFactory.java:9
> 4) at
> org.jbiowhpersistence.datasets.drug.drugbank.search.SearchDrugBank.search(Se
> archDrugBank.java:85) at org.drugbanksearch.Main.run(Main.java:40)
> at org.drugbanksearch.Main.main(Main.java:61)
> Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services -
> 2.5.2.v20140319-9ad6abd):
> org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception: java.sql.SQLException: No database selected
> Error Code: 1046
> Call: SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID,
> Description, HalfLife, Id, Indication, MechanismOfAction, Name,
> Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity,
> Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?
> bind => [1 parameter bound]
> Query: ReadAllQuery(referenceClass=DrugBank sql="SELECT WID, Absorption,
> CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id,
> Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding,
> RouteOfElimination, SynthesisRef, Toxicity, Type, Updated,
> VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?")
> at
> org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseEx
> ception.java:340) at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecut
> eCall(DatabaseAccessor.java:682) at
> Query.java:1127) at
> org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403)
> at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(Obj
> ectLevelReadQuery.java:1215) at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuer
> y(UnitOfWorkImpl.java:2896) at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstr
> actSession.java:1804) at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstr
> actSession.java:1786) at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstr
> actSession.java:1751) at
> org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.ja
> > org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryI
> > mp>
> > > l.java:378) at
> >
> > org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.
> > ja>
> > > va:260) at
> >
> > org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.jav
> > a:
> >

Roberto Vera Alvarez

unread,
Oct 27, 2014, 6:04:17 PM10/27/14
to jbiowh-...@googlegroups.com
Hi Douglas,

I see now. Good, I'm happy that it is working.

Let me know if you need more help.

Regards,
Roberto

On Monday, October 27, 2014 03:02:13 PM Douglas Myers-Turnbull wrote:
> Hi Roberto,
>
> > mpl.java:378) at
> > org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.
> > java:260) at
> > org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.jav
> > a:469) at
> > org.jbiowhpersistence.utils.search.SearchFactory.search(SearchFactory.java
> > :94) at
> > org.jbiowhpersistence.datasets.drug.drugbank.search.SearchDrugBank.search(
> > SearchDrugBank.java:85) at org.drugbanksearch.Main.run(Main.java:40)
> > at org.drugbanksearch.Main.main(Main.java:61)
> > Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services -
> > 2.5.2.v20140319-9ad6abd):
> > org.eclipse.persistence.exceptions.DatabaseException
> > Internal Exception: java.sql.SQLException: No database selected
> > Error Code: 1046
> > Call: SELECT WID, Absorption, CASNumber, Clearance, Created, DataSet_WID,
> > Description, HalfLife, Id, Indication, MechanismOfAction, Name,
> > Pharmacology, ProteinBinding, RouteOfElimination, SynthesisRef, Toxicity,
> > Type, Updated, VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?
> > bind => [1 parameter bound]
> > Query: ReadAllQuery(referenceClass=DrugBank sql="SELECT WID, Absorption,
> > CASNumber, Clearance, Created, DataSet_WID, Description, HalfLife, Id,
> > Indication, MechanismOfAction, Name, Pharmacology, ProteinBinding,
> > RouteOfElimination, SynthesisRef, Toxicity, Type, Updated,
> > VolumeOfDistribution FROM DrugBank WHERE Id LIKE ?")
> > at
> > org.eclipse.persistence.exceptions.DatabaseException.sqlException(Database
> > Exception.java:340) at
> > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExec
> > uteCall(DatabaseAccessor.java:682) at
> > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCa
> > ll(DatabaseAccessor.java:558) at
> > org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall
> > (AbstractSession.java:2002) at
> > org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSe
> > ssion.java:570) at
> > org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.exec
> > uteCall(DatasourceCallQueryMechanism.java:242) at
> > org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.exec
> > uteCall(DatasourceCallQueryMechanism.java:228) at
> > org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.exec
> > uteSelectCall(DatasourceCallQueryMechanism.java:299) at
> > org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.sele
> > ctAllRows(DatasourceCallQueryMechanism.java:694) at
> > org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAl
> > lRowsFromTable(ExpressionQueryMechanism.java:2738) at
> > org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAl
> > lRows(ExpressionQueryMechanism.java:2691) at
> > org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(R
> > eadAllQuery.java:495) at
> > org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(
> > ObjectLevelReadQuery.java:1168) at
> > org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:8
> > 99) at
> > org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelRe
> > adQuery.java:1127) at
> > org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403
> > )
> > at
> > org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(O
> > bjectLevelReadQuery.java:1215) at
> > org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQu
> > ery(UnitOfWorkImpl.java:2896) at
> > org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abs
> > tractSession.java:1804) at
> > org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abs
> > tractSession.java:1786) at
> > org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abs
> > tractSession.java:1751) at
> > org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.
> > java:258) ... 5 more
> > Caused by: java.sql.SQLException: No database selected
> > at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
> > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
> > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
> > at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
> > at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
> > at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
> > at
> > com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:19
> > 07) at
> > com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2030)
> > at
> > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSe
> > lect(DatabaseAccessor.java:1007) at
> > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExec
> > org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryI
> > mp>
> > > l.java:378) at
> >
> > org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.
> > ja>
> > > va:260) at
> >
> > org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.jav
> > a:
> >
> > org.jbiowhpersistence.datasets.drug.drugbank.search.SearchDrugBank.search(
> > Se>
> > > archDrugBank.java:85) at
> >
> > org.pharmgkb.genome.demo.DemoDrugBankSearch.run(DemoDrugBankSearch.java:41
> > )
> >
> > > at
> >
> > org.pharmgkb.genome.demo.DemoDrugBankSearch.main(DemoDrugBankSearch.java:6
> > 2)>
Reply all
Reply to author
Forward
0 new messages