derby

How should I use UUID with JavaDB/Derby and JDBC?

£可爱£侵袭症+ 提交于 2019-12-04 11:22:24
I currently use INT as type for primary key in JavaDB (Apache Derby), but since I'm implementing an distributed system I would like to change the type to java.util.UUID . A few questions about this: What datatype in JavaDB/Derby should I use for UUID? I have seen CHAR(16) FOR BIT DATA been mentioned but I don't know much about it. Is VARCHAR(16) an alternative? How should I use it with JDBC? E.g. in an PreparedStatement , how should I set and get an UUID? If I later would likte to change database to SQL Server, is there a compatible datatype to java.util.UUID? Simply, How should I use UUID

Java SQL Exception Invalid Cursor State - no current row

北战南征 提交于 2019-12-04 08:03:00
I've been having a hard time trying to figure this out. First I have an insertProduct(Product p) method that is supposed to check if a product with the specified code exists in the database. If so, this method will display an error message. Otherwise, it should add the product to the database and print it to the console. I'm not sure if I'm doing that correctly. Second, the deleteProduct(Product p) method is supposed to delete the product that was added by the insertProduct method. Now the thing is that I keep getting a SQL Exception when I try to add the product and then the deleteProduct

Eclipselink JPA gets error when inserting into Derby table with generated primary key

我只是一个虾纸丫 提交于 2019-12-04 04:27:42
问题 EclipseLink seems to be incorrectly passing a null primary key value to Derby when persisting into a table with generated primary key. Derby returns error of Attempt to modify an identity column in this case. Derby needs a SQL statement that excludes the id value. My question is how do I coerce EclipseLink to send the right SQL? Details follow... I am using Eclipselink to map to a Derby database (v10.8.1.2) under the latest Netbeans 7.3beta2. The database table primary key is auto generated:

Error connecting to server localhost on port 1527 with message Connection refused

本小妞迷上赌 提交于 2019-12-04 04:27:21
问题 i am create a java project and i want to use derby data base and and i am configured database and create database with the name of /home/user/TestDB and create a table user and insert 3 to 4 values into it and write a code to get the data from database but when i connect dada base i got connection refuse error, i am use DB URL : jdbc:derby://localhost:1527/home/user/TestDB error logs : java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server

Resultset not open. Verify Autocommit is OFF. Apache Debry

巧了我就是萌 提交于 2019-12-04 03:53:37
I am using apache derby for my database. I am able to perform inserts into the database. The following is the excerpt from the code that attempts to display the contents of my only table 'MAINTAB'. The instance of java.sql.Connection is 'dbconn'. ResultSet word; Statement query; String getData="SELECT THEWORD FROM MAINTAB"; try{ System.out.println(dbconn.getAutoCommit()); query = dbconn.createStatement(); word = query.executeQuery(getData); query.close(); dbconn.setAutoCommit(false); System.out.println(dbconn.getAutoCommit()); for(;word.next();) System.out.println(word.getString(1)); }catch

apache derby - explain select

二次信任 提交于 2019-12-04 03:48:07
I'm programming Java application working with Apache Derby and i'm looking for equivalent for "explain" statement (working for mySQL for example). It's not working in Derby. Is there something similar? There are similar things: Firstly, there is derby.language.logQueryPlan=true, which writes query plan information to the log file: http://db.apache.org/derby/docs/10.8/ref/rrefproper43414.html . Secondly, there is the RUNTIMESTATISTICS feature, which can capture the statistics into your program if you want: http://db.apache.org/derby/docs/10.8/ref/rrefsqlj38831.html . Thirdly, there is XPLAIN

How to setup a JTA data source in EclipseLink/JPA 2.0 in an Java EE 6 application for derby embedded database?

孤者浪人 提交于 2019-12-04 03:28:37
问题 I am not able to find ecbDB JTA data source in the unit test. For RESOURCE_LOCAL the same persistence.xml works. Only within an EJB container it fails to locate a JTA data source. I get the following exception when the unit test is executed.. SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'ecbDB' in SerialContext [Root exception is javax.naming.NameNotFoundException:

db derby StartNetworkServer

蓝咒 提交于 2019-12-03 21:34:07
I have problem with starting derby server. My derby version: db-derby-10.11.1.1 I followed this tutorial: http://db.apache.org/derby/papers/DerbyTut/ns_intro.html but after typing: startNetworkServer.bat there is no response: https://www.dropbox.com/s/bo1tgfj8gf2533i/derby_issue.PNG?dl=0 Could you help me? Maybe there is some problem with my localhost? I think that i install Derby correctly because after typing: java org.apache.derby.tools.sysinfo I got some result regards DavidJezek The bug is in the localization (for me in cs localization) and the derby server does not print exceptions by

Derby or MySQL or…?

江枫思渺然 提交于 2019-12-03 11:27:53
问题 For what type of requirements would you choose Apache Derby (or Java DB) over MySQL (or vice versa)? I looked around and people just compare the two but no one talks about when to consider each one. I am developing a web-based application using Glassfish + Java/Restlet + MySQL. I expect around 100-200 users for this system with a load of about 30-50 concurrent users at a given time - mostly. I was told to look at Derby if I wish to make the web-app downloadable/distributable. But is that the

Java EE 6 embedded glassfish embedded derby EJB unit test

六月ゝ 毕业季﹏ 提交于 2019-12-03 09:13:23
questing is about javaee6 with embedded glassfish and embedded derby jndi lookup for data source at the time of deployment before unit test is executed.... Please find the persistence.xml here... <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="mymodulePU" transaction-type="JTA"> <provider>org.eclipse.persistence.jpa.PersistenceProvider