I have tried junit with hsqldb(v2.2.6),but it doesn't seem to support geometry.
Here is my code and error info:
java:
#Type(type = "org.hibernatespatial.GeometryUserType")
#Column(columnDefinition = "MDSYS.SDO_GEOMETRY")
public Point getGeometry() {
return geometry;
}
errors:
DEBUG - com.mchange.v2.c3p0.impl.NewPooledConnection#126f816 handling a throwable.
java.sql.SQLException: invalid schema name: MDSYS
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.executeUpdate(Unknown Source)
at com.mchange.v2.c3p0.impl.NewProxyStatement.executeUpdate(NewProxyStatement.java:64)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:204)
How do I handle it ?
MDSYS.SDO_GEOMETRY is an Oracle type if I'm not mistaken. So that won't work with HSQLDB.
The manual does not list a geometry type: http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#N103C9
So I guess your only option is to file an enhancement request.
Related
Using Com4j with iTunes, no problem adding various text values to a IITrack object but if I try and add artwork with
if(iTunesTrack.artwork().count()==0)
{
String path = new File(new File(song.getFilename()).getParent(),"folder.jpg").getPath();
if(Files.exists(Paths.get(path)))
{
iTunesTrack.addArtworkFromFile(path);
}
}
it fails with
11/05/2017 18.24.56:BST:com.jthink.songkong.ituneshelper.WindowsUpdateItunesWithChanges:updateITunesLibTrackFromSong:SEVERE: Unable to update ItunesTrack C:\Users\Paul\Desktop\TestMusic\WAV\Music\Choir of Trinity College\Carols From Trinity\27 - In Dulci Jubilo (organ solo).wav:8000ffff Catastrophic failure : Catastrophic failure
com4j.ComException: 8000ffff Catastrophic failure : Catastrophic failure : .\invoke.cpp:517
at com4j.Wrapper.invoke(Wrapper.java:187)
at com.sun.proxy.$Proxy57.addArtworkFromFile(Unknown Source)
at com.jthink.songkong.ituneshelper.WindowsUpdateItunesWithChanges.updateITunesLibTrackFromSong(WindowsUpdateItunesWithChanges.java:611)
at com.jthink.songkong.ituneshelper.WindowsUpdateItunesWithChanges.addEditedTrack(WindowsUpdateItunesWithChanges.java:646)
at com.jthink.songkong.ituneshelper.WindowsUpdateItunesWithChanges.analyseFiles(WindowsUpdateItunesWithChanges.java:277)
at com.jthink.songkong.ituneshelper.WindowsUpdateItunesWithChanges.updateItunes(WindowsUpdateItunesWithChanges.java:180)
at com.jthink.songkong.ituneshelper.UpdateItunesWithChanges.call(UpdateItunesWithChanges.java:182)
at com.jthink.songkong.ituneshelper.UpdateItunesWithChanges.call(UpdateItunesWithChanges.java:32)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com4j.ComException: 8000ffff Catastrophic failure : Catastrophic failure : .\invoke.cpp:517
at com4j.Native.invoke(Native Method)
at com4j.StandardComMethod.invoke(StandardComMethod.java:35)
at com4j.Wrapper$InvocationThunk.call(Wrapper.java:356)
at com4j.Task.invoke(Task.java:50)
at com4j.ComThread.run0(ComThread.java:172)
at com4j.ComThread.run(ComThread.java:153)
The COM4j interfaces were built from my version of iTunes so they exist, I don't know if I am doing anything wrong or if its broken, I ve had tried on a number of jpogs all with the same result. I check the files exist and indeed the error is different if try to add a nonexistent file.
I am new to the concept of OLAP DB.
Please excuse me if I missed out something in the Connection String.
I am trying to connect to connect to Microsoft Analysis Server(which is in different Domain) from my System.
While Connecting I am getting below Error.
Can you please let me know, what am I doing wrong?
I have executed the Steps Mentioned in :
https://msdn.microsoft.com/en-us/library/gg492140.aspx
and referred to the below link for connection to the Cube:
http://www.matthewgodding.com/articles/2010/2/27/getting-data-from-sql-analysis-services-using-java-and-olap4.html
After connecting to the CUbe, I need to execute MDX Query.
Please find the snippet of the code I am using:
public static void main(String[] args) {
try {
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
final Connection connection = DriverManager
.getConnection("jdbc:xmla:Server=http://Remote_Server_IPAddress/OLAP/msmdpump.dll;"
+ "Catalog=MyCatalog;"
+ "User='Domian\\Username';" \\ This is the Username to login to the Server
+ "Password='Password';" \\ This is the Password to login to the Server
+ "Cube=Cube;"); \\This is the Cube Name
I get the below Exception when I execute the program:
Exception:
java.lang.RuntimeException: org.olap4j.OlapException: This connection encountered an exception while executing a query.
at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:96)
at org.olap4j.driver.xmla.DeferredNamedListImpl.size(DeferredNamedListImpl.java:116)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.getOlapDatabase(XmlaOlap4jConnection.java:451)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.getDatabase(XmlaOlap4jConnection.java:444)
at org.sid.practise.CheckConnection.main(CheckConnection.java:79)
Caused by: org.olap4j.OlapException: This connection encountered an exception while executing a query.
at org.olap4j.driver.xmla.XmlaHelper.createException(XmlaHelper.java:43)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.executeMetadataRequest(XmlaOlap4jConnection.java:878)
at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:137)
at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:67)
at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getDatabaseProperties(XmlaOlap4jDatabaseMetaData.java:1044)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.makeConnectionPropertyList(XmlaOlap4jConnection.java:324)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.generateRequest(XmlaOlap4jConnection.java:1037)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:849)
at org.olap4j.driver.xmla.DeferredNamedListImpl.populateList(DeferredNamedListImpl.java:136)
at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:90)
... 4 more
Caused by: org.olap4j.driver.xmla.proxy.XmlaOlap4jProxyException: This proxy encountered an exception while processing the query.
at org.olap4j.driver.xmla.proxy.XmlaOlap4jHttpProxy.getResponse(XmlaOlap4jHttpProxy.java:181)
at org.olap4j.driver.xmla.proxy.XmlaOlap4jAbstractHttpProxy.get(XmlaOlap4jAbstractHttpProxy.java:181)
at org.olap4j.driver.xmla.proxy.XmlaOlap4jHttpProxy.get(XmlaOlap4jHttpProxy.java:42)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.executeMetadataRequest(XmlaOlap4jConnection.java:876)
... 12 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at org.olap4j.driver.xmla.proxy.XmlaOlap4jHttpProxy.getResponse(XmlaOlap4jHttpProxy.java:136)
It's difficult to know what went wrong for you. Few things you could do,
Don't specify cube in connection. This is not listed as property in XMLA driver.
You can install fiddler and see what's going on with the requests.
Not sure if single quotes are needed in user name and password.
I'm trying to limit the sql result from some statements, for example to 100 from an application in Java using spring-boot, and a DB2 database in an AS400.
I've tryied this two things, extending a CrudRepository
public List<AcumuladoEstadistico> findFirst10BySincroEstado(String aEstado);
and also this
#Query(name="FROM AcumuladoEstadistico a WHERE a.sincroEstado = ?1 limit 5", countQuery="10")
Iterable<AcumuladoEstadistico> findFirst10BySincroEstado(String aEstado);
but in both cases I have the following error
Caused by: java.sql.SQLException: [SQL0104] Símbolo LIMIT no válido. Símbolos válidos: FOR SKIP WITH FETCH ORDER UNION EXCEPT OPTIMIZE.
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:650)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:621)
at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1557)
at com.ibm.as400.access.AS400JDBCPreparedStatement.(AS400JDBCPreparedStatement.java:193)
at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:2025)
at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1824)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)
at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:81)
at com.sun.proxy.$Proxy61.prepareStatement(Unknown Source)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:162)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186)
... 69 more
Why I have this problem, maybe Hibernate doesn't create the statement properly for DB2? What can I do?
Thanks a lot!
Finally I've found the problem, I was using an incorrect dialect in the properties of sping
Thanks a lot!
Recently I have been trying a lot and scratching everywhere to connect to a derby database using NetBeans 8.0. After a lot of research in SO (link1, link2, link3, link4) and everywhere else I am unable to understand that how to make it go away.I realize this is the reason :-(the db.lck) that I am not getting a connection to the embedded apache derby DB.
I notice that db.lck appears while I compile the Java program. Is that a reason that I am denied to a embedded apache derby connection?
N.B :-1. I connected to the JavaDB Server.2. Disconnected the connection to the DB while compiling the program.3. Added the relevant jar file derby.jar.4. Created the database with default schema APP used username and password both as app.
5. Removed the create=true option from the connection string.
6. I can view and manipulate the data through the SQL console in NetBeans 8.0
Providing the code below for further reference :
test.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class test
{
public static void main(String args [])
{
try {
Connection con = DriverManager.getConnection("jdbc:derby:C:/Users/Dhruvh/Documents/NetBeansProjects/ApacheDerby/derbytest","app","app");
PreparedStatement stmt=con.prepareStatement("select * from \"APP\".TABLE1");
ResultSet rs=stmt.executeQuery();
if(rs.next())
{
System.out.println("Id : "+rs.getInt(1) +" "+" name :"+rs.getString(2));
}
else
{
System.out.println("No word matching in database");
}
} catch (SQLException err) {
System.out.println(err.getMessage());
}
}
}
I have also tried using:-
PreparedStatement stmt=con.prepareStatement("select * from APP.TABLE1");
PreparedStatement stmt=con.prepareStatement("select * from TABLE1");
PreparedStatement stmt=con.prepareStatement("select * from app.table1"); //table was created in lower case
But everything I mention above gave the same error:-
Table/View 'APP.TABLE1' does not exist.
StackTrace:
java.sql.SQLSyntaxErrorException: Table/View 'APP.TABLE1' does not exist.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement42.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver42.newEmbedPreparedStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at test.main(test.java:12)
Caused by: ERROR 42X05: Table/View 'APP.TABLE1' does not exist.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source)
at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source)
at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
Also proving a snapshot of the created DB
Please tell if any further references are needed to solve the problem.
Thanks for you patience
You gave derby location of a database that doesn't exist, so it tries to create the database itself.
jdbc:derby:C:/Users/Dhruvh/Documents/NetBeansProjects/ApacheDerby/src/derbytest;**create=true**
The bold part is a default argument which you leave out in your driver creation.
You can connect to the database but there doesn't exist a table you want to access. You have to fix the location of the database. Also if you are connected to the db through your program(looks like mplab x ?), you need to terminate that connection first.
I have JPA2 with EclipseLink 2.4, and I'm trying to implement an in-memory database using HSQLDB. I have been able to create a file implementation of the hsqldb using
jdbc:hsqldb:file:./databases/test;shutdown=true;files_readonly=true
But when I try to use jdbc:hsqldb:mem:tableName, I get the following message:
Stacktrace:
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse
Persistence Services - 2.4.0.v20120608-r11652):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: user lacks privilege or object
not found: EFFECTIVITY
Error Code: -5501
Call: INSERT INTO EFFECTIVITY (HULL) VALUES (?)
bind => [1 parameter bound]
Query: InsertObjectQuery(101)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush
(EntityManagerImpl.java:804)
at com.gdeb.touchtable.db.TestJPAEntities.testTTTouch(TestJPAEntities.java:93)
..............
Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found:
EFFECTIVITY
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.SchemaManager.getTable(Unknown Source)
at org.hsqldb.ParserDQL.readTableName(Unknown Source)
at org.hsqldb.ParserDQL.readRangeVariableForDataChange(Unknown Source)
at org.hsqldb.ParserDML.compileInsertStatement(Unknown Source)
at org.hsqldb.ParserCommand.compilePart(Unknown Source)
at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
at org.hsqldb.Session.compileStatement(Unknown Source)
at org.hsqldb.StatementManager.compile(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 63 more
From what I read, the data model should be generated automagically, but I have only seen examples with Hibernate. Is there a way to link the JPA data-model and create it using the memory mode of HSQLDB?
If what is missing are the tables, you need to set the eclipselink.ddl-generation property with a value of "create-tables" to have Eclipselink create them for you. An example is posted here: http://wiki.eclipse.org/EclipseLink/Examples/JPA/DDL