I searched around and the only similar StackOverflow thread doesn't address what I'm looking for.
I have defined an auxillary database object in Hibernate like so:
<database-object>
<create>ALTER TABLE project ADD CONSTRAINT UNIQUE `unique_id` (`userId`);</create>
<drop></drop>
</database-object>
Upon setting up my database and running against passing tests, I get this error thrown:
01:56:04.337> WARN ExceptionHandlerLoggedImpl:27 GenerationTarget encountered exception accepting command : Error executing DDL "ALTER TABLE project ADD CONSTRAINT UNIQUE `unique_id` (`userId`);" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "ALTER TABLE project ADD CONSTRAINT UNIQUE `unique_id` (`userId`);" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:458)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:442)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:406)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:169)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:138)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:124)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:164)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:81)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:335)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:471)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:728)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:746)
at com.ekotrope.server.jdo.BaseJdoTestClass.startServices(BaseJdoTestClass.java:221)
at com.ekotrope.server.jdo.BaseJdoTestClass.beforeClass(BaseJdoTestClass.java:112)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
Caused by: java.sql.SQLSyntaxErrorException: unexpected token: UNIQUE
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)
at com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:75)
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
... 31 more
Caused by: org.hsqldb.HsqlException: unexpected token: UNIQUE
at org.hsqldb.error.Error.parseError(Unknown Source)
at org.hsqldb.ParserBase.unexpectedToken(Unknown Source)
at org.hsqldb.ParserBase.checkIsNonCoreReservedIdentifier(Unknown Source)
at org.hsqldb.ParserDQL.checkIsSchemaObjectName(Unknown Source)
at org.hsqldb.ParserDQL.readNewSchemaObjectName(Unknown Source)
at org.hsqldb.ParserDQL.readNewDependentSchemaObjectName(Unknown Source)
at org.hsqldb.ParserDDL.compileAlterTable(Unknown Source)
at org.hsqldb.ParserDDL.compileAlter(Unknown Source)
at org.hsqldb.ParserCommand.compilePart(Unknown Source)
at org.hsqldb.ParserCommand.compileStatements(Unknown Source)
at org.hsqldb.Session.executeDirectStatement(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 35 more
This is incredibly confusing because executing the above statement within my database (MariaDB) is perfectly valid, yet JDBC doesn't recognize a perfectly fine statement.
Related
I'm using UcanAccess (http://ucanaccess.sourceforge.net/site.html) to read a .MDB database from Java.
The application is running in a Ubuntu server and it is reading the database from a Samba connection.
On Windows machine it works, but on Linux I've some problems.
Here some data:
Url: jdbc:ucanaccess:///mnt/database/TEST.MDB;jackcessOpener=it.plugins.CryptCodecOpener
The database requires a password when I open it from Access. The database is used from another application, in fact I see in the same folder the .ldb file.
When I try to read data from DB I've this exception:
Dataset App.ti 1gg mdb (17) Plugin: TestMdb.jar: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.5 invalid authorization specification - not found: Admin
at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at it.test.plugins.Testmdb.TestMdb.getConnection(TestMdb.java:120)
at it.test.plugins.Testmdb.TestMdb.testConnessione(TestMdb.java:135)
at it.test.plugins.PluginManager.getAppuntamenti(PluginManager.java:247)
at it.test.plugins.PluginManager$$FastClassBySpringCGLIB$$180b607d.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at it.test.plugins.PluginManager$$EnhancerBySpringCGLIB$$ece2d5aa.getAppuntamenti(<generated>)
at it.test.task.AppuntamentiTask.esegui(AppuntamentiTask.java:176)
at sun.reflect.GeneratedMethodAccessor141.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.5 invalid authorization specification - not found: Admin
at net.ucanaccess.jdbc.UcanaccessConnection.<init>(UcanaccessConnection.java:110)
at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:254)
... 28 more
Caused by: java.sql.SQLInvalidAuthorizationSpecException: invalid authorization specification - not found: Admin
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at net.ucanaccess.jdbc.DBReference.getHSQLDBConnection(DBReference.java:440)
at net.ucanaccess.jdbc.UcanaccessConnection.<init>(UcanaccessConnection.java:107)
... 29 more
Caused by: org.hsqldb.HsqlException: invalid authorization specification - not found: Admin
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.rights.UserManager.get(Unknown Source)
at org.hsqldb.rights.UserManager.getUser(Unknown Source)
at org.hsqldb.Database.connect(Unknown Source)
at org.hsqldb.DatabaseManager.newSession(Unknown Source)
... 36 more
But if I do a cp originalDatabase.MDB copiedDatabase.MDB and I change UcanAccess url using the copied database, everything works fine without any change!
This is how I mounted the share:
//192.168.101.100/g/DATABASE /mnt/database cifs user=,password=,gid=1005,uid=1001 0 0
where 1001 is the uid of the user that runs my java application.
I want to point out that the same application on Windows works fine without the need to copy the original database in order to access to it.
Am I missing something?
I'm using Node JDBC module to connect to Impala, but I'm getting a 500151 error on connection. My connection string is jdbc:impala://myhost:21050;AuthMech=3;transportMode=http;httpPath=cliservice;UID=user;PWD=password
Here is the error messege:
Error: Error running static method
java.sql.SQLException: [Simba][ImpalaJDBCDriver](500151) Error setting/closing session: {0}.
at com.cloudera.hivecommon.api.HS2Client.openSession(Unknown Source)
at com.cloudera.hivecommon.api.HS2Client.<init>(Unknown Source)
at com.cloudera.hivecommon.api.HiveServer2ClientFactory.createClient(Unknown Source)
at com.cloudera.hivecommon.core.HiveJDBCCommonConnection.connect(Unknown Source)
at com.cloudera.impala.core.ImpalaJDBCConnection.connect(Unknown Source)
at com.cloudera.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
at com.cloudera.jdbc.common.AbstractDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: com.cloudera.support.exceptions.GeneralException: [Simba][ImpalaJDBCDriver](500151) Error setting/closing session: {0}.
... 12 more
Caused by: org.apache.thrift.transport.TTransportException
at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378)
at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:156)
at com.cloudera.hivecommon.api.HS2ClientWrapper.recv_OpenSession(Unknown Source)
at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:143)
at com.cloudera.hivecommon.api.HS2ClientWrapper.OpenSession(Unknown Source)
at com.cloudera.hivecommon.api.HS2Client.openSession(Unknown Source)
at com.cloudera.hivecommon.api.HS2Client.<init>(Unknown Source)
at com.cloudera.hivecommon.api.HiveServer2ClientFactory.createClient(Unknown Source)
at com.cloudera.hivecommon.core.HiveJDBCCommonConnection.connect(Unknown Source)
at com.cloudera.impala.core.ImpalaJDBCConnection.connect(Unknown Source)
at com.cloudera.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
at com.cloudera.jdbc.common.AbstractDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
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:498)
I know for sure there's nothing wrong with the credential and AuthMech. Someone please help.
Problem solved. I upgraded my Impala JDBC driver to 41, and got rid of transportMode=http;httpPath=cliservice in my connection string.
I'm trying to connect to a derby database.
I have the following error in the console after running the app:
01:07:31.698 [main] INFO o.s.j.d.DriverManagerDataSource - Loaded JDBC driver: org.apache.derby.jdbc.EmbeddedDriver
Creating records
01:07:31.826 [main] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL update
01:07:31.828 [main] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [INSERT INTO `students` (name,age) VALUES (?,?)]
01:07:31.845 [main] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
01:07:31.845 [main] DEBUG o.s.j.d.DriverManagerDataSource - Creating new JDBC DriverManager Connection to [jdbc:derby:c:\temp\database\test01;create=true]
Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Failed to start database 'c:\temp\database\test01' with class loader sun.misc.Launcher$AppClassLoader#6d9bf996, see the next exception for details.
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:628)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:907)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:968)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:978)
at Student.dao.StudentImplementationOfDao.insert(StudentImplementationOfDao.java:22)
at main.Application.main(Application.java:31)
Caused by: java.sql.SQLException: Failed to start database 'c:\temp\database\test01' with class loader sun.misc.Launcher$AppClassLoader#6d9bf996, see the next exception for details.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:153)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:144)
at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:155)
at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:120)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
... 6 more
Caused by: java.sql.SQLException: Failed to start database 'c:\temp\database\test01' with class loader sun.misc.Launcher$AppClassLoader#6d9bf996, see the next exception for details.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
... 24 more
Caused by: java.sql.SQLException: Another instance of Derby may have already booted the database C:\temp\database\test01.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
... 21 more
Caused by: ERROR XSDB6: Another instance of Derby may have already booted the database C:\temp\database\test01.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(Unknown Source)
at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unknown Source)
at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown Source)
at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown Source)
... 21 more
The code that I built to connect to the database is:
DriverManagerDataSource ds = new DriverManagerDataSource();
ds.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
ds.setUrl("jdbc:derby:c:\\temp\\database\\test01;create=true");
ds.setUsername("");
ds.setPassword("");
siod.setDataSource(ds);
From what I could understand in the errors shown above is something to do with a PreparedStatement that tries to gets inserted.
The sql statement is:
"INSERT INTO `students` (name,age) VALUES (?,?)
I parsed this sql to a instantiated JdbcTemplate which has the dataSource mentioned above.
Here is the exact code:
public void insert(Student student)
{
//ds is simply the dataSource that gets created in the code example above
JdbcTemplate create = new JdbcTemplate(ds);
create.update(sql,new Object[]{student.name,student.age});
}
I'm sure this question has a simple answer but I just don't understand what exactly is causing this error. Is it the statement? Is it cause the connection fails? How do I solve whatever makes my code fail?
Thank you
Another instance of Derby may have already booted the database
C:\temp\database\test01.
With an embedded database, only the application that it is embedded in can access it. Check to make sure that your previous application is fully stopped. The simplest solution for that is to just restart your operating system, but if you are familiar with killing processes, you can look for all your java processes and kill them.
Another thing I have seen sometimes is somebody copying the files from a Derby database to another location, while that Derby database was being used. This leaves the copy of the database in a locked state. That's likely not your problem though.
I have an application consisting of: Spring, WebSphere, accessing DB2 jdbc.
Everything is set up ok, the application is usually published, because when I go to select a seat at any table I get this following error.
OsjsSQLErrorCodeSQLExceptionTranslator DEBUG - Translating SQLException with SQL
state '42Y07 ', error code '30000', message [Schema 'DBPROD' does not exist]; SQL was
[SELECT * FROM DBPROD.EXPUR_CONS_CRIVO] for task [PreparedStatementCallback]
[10/24/11 10:11:54:257 EST] 0000001b SystemOut The 10:11:54.249 [WebContainer: 1]
ERROR bcbwahdHistoricoDescontoDAOImpl - [requestID A8IUK52K =]
HistoricoDescontoDAOImpl.consultarHistoricoDesconto Terminating with error ()
org.springframework.dao.DataAccessResourceFailureException: PreparedStatementCallback;
SQL [SELECT * FROM DBPROD.EXPUR_CONS_CRIVO]; Schema 'DBPROD' does not exist;
java.sql.SQLSyntaxErrorException nested exception is: Schema 'DBPROD' does not exist
at [spring-jdbc-3.0.1.RELEASE.jar: 3.0.1.RELEASE]
at [spring-jdbc-3.0.1.RELEASE.jar: 3.0.1.RELEASE]
Caused by: org.apache.derby.impl.jdbc.EmbedSQLException: Schema 'DBPROD' does not exist
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) [derby-10.5.3.0_1.jar:na]
... 191 common frames omitted
Caused by: org.apache.derby.iapi.error.StandardException: Schema 'DBPROD' does not exist
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source) [derby-10.5.3.0_1.jar:na]
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source) [derby-10.5.3.0_1.jar:na]
... 185 common frames omitted
my user has full access to the database, since I do not know what to do.
SQL State codes beginning with '42' refer usually to Syntax errors, but in your Case its pretty clear that Schema is missing.
Check these Links hope they will help you solve this problem:
CURRENT SCHEMA special register
how do i get the current schema on DB2 if i have a JDBC conneciton?
As it has been mentioned, the error messages you get are from an Apache Derby JDBC driver. Check that you chose the correct datasource when you configured your application in WebSphere.
I use Hibernate for JPA DB mapping with Derby DB. For a complex object structure I am getting "org.apache.derby.client.am.SqlException: SELECT statement has too many items in GROUP BY, ORDER BY or select list":
org.apache.derby.client.am.SqlException: SELECT statement has too many items in GROUP BY, ORDER BY or select list.
org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source)
org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(Unknown Source)
org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(Unknown Source)
org.apache.derby.client.am.PreparedStatement.prepare(Unknown Source)
org.apache.derby.client.am.Connection.prepareStatementX(Unknown Source)
org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)
org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
org.hibernate.loader.Loader.doQuery(Loader.java:673)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3044)
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:229)
org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:120)
org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:228)
sun.reflect.GeneratedMethodAccessor376.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
$Proxy74.merge(Unknown Source)
sun.reflect.GeneratedMethodAccessor376.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
$Proxy41.merge(Unknown Source)
Has anyone run into this problem and if what was the solution? I am thinking of
switching to MySQL
lazily load some attributes (fetch=FetchType.LAZY)
redesign DB schema (that might be difficult now, DB is generated using Hyperjaxb from XSD schemas and shemas would have to be changed)
For which solution would you go? Do you know what are the limitations of Derby for SQL statements?
Try debugging it with show_sql=true doc
Check the SQL generated and try debugging it .
I believe Derby allows approximately 32,000 columns in the GROUP BY clause. There are similar limits for ORDER BY, and for the columns named in the SELECT list.