derby

JavaDB - Checking if a database exists

心已入冬 提交于 2019-12-08 20:53:15
问题 We created a java application which uses the JavaDB database in Netbeans IDE. We want the program to check every time it starts if the database's tables have already been created, and otherwise create them. How do we do that? thanx 回答1: I use : DatabaseMetaData metas; ResultSet tables; Statement stat; m_connexion = DriverManager.getConnection("jdbc:derby:mybase;create=true"); metas = m_connexion.getMetaData(); stat = m_connexion.createStatement(); tables = metas.getTables(m_connexion

conditional statements in derby

我的梦境 提交于 2019-12-08 19:32:03
问题 It looks like derby doesn't support conditional statements [IF]. How do we write if exists (select 1 from customers where name='somename') update customers ... else insert into customers ... in derby? Derby doesn't have 'replace into' of mysql either. Note: I am using derby as unit-testing replacement for mysql [that is production will use mysql and unit-test will use derby]. 回答1: What about http://db.apache.org/derby/docs/10.2/ref/rrefcasenullif.html#rrefcasenullif? CASE WHEN 1 = 2 THEN 3

Have additional connections to Derby (read-only)

杀马特。学长 韩版系。学妹 提交于 2019-12-08 16:33:25
问题 What I want to do: My application has a full connection to a Derby DB, and I want to poke around in the DB (read-only) in parallel (using a different tool). I'm not sure how Derby actually works internally, but I understand that I can have only 1 active connection to a Derby DB. However, since the DB is only consisting of files on my HDD, shouldn't I be able to open additional connections to it, in read-only mode? Are there any tools to do just that? 回答1: There are two possibilities how to

Java SQL error, no suitable driver found

寵の児 提交于 2019-12-08 14:12:31
I'm trying to compile this small piece of code, to help me connect to my db and retrieve some information to test it. I am using Netbeans on a Windows 7 x64 machine. This is the code: package passwordprotector; import java.sql.*; public class PasswordProtector { /** * @param args the command line arguments */ public static void main(String[] args) { String host = "jdbc:derby://localhost:1527/PasswordProtector DB"; String dbUsername = "john"; String dbPassword = "arsenal"; /*try{ Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); }catch(ClassNotFoundException e){ System.out.println(e); }*/

Convert single-user Apache Derby database to one with users

放肆的年华 提交于 2019-12-08 11:58:09
问题 I have an Apache Derby database that, until now, has always been locally accessed. It needs to be accessed by multiple computers now, so I feel it ought to have a username/password. How do I take the existing database and retroactively add a user How do I provide local/network authentication for that user? I recall looking through their docs a few years ago, and it seem like there was a lot left to a developer to implement in these cases. To clarify more, regarding point #1, this page says:

SQLNonTransientConnectionException - new Connection Profile

醉酒当歌 提交于 2019-12-08 11:09:08
问题 I want to make a super simple console application that works over a network. I'm using a simple maven project for which I have added the derbyclient dependency(There is no usefull code in the project at this stage). I also have tomcat 8 running. When I try to get a connection profile thru the data source explorer I get an error. Pictures for clarity: I've searched for the solution and got a few hits, but they weren't quite helpful. I know the question might be dumb, but I'm new to this stuff,

Spring Batch JdbcPagingItemReader seems not paginating

陌路散爱 提交于 2019-12-08 07:29:01
问题 I'm working on an app that indexes a bunch of files in an embedded Derby(10.12.1.1) DB and then are exported as one single tabulated file. The first part is working fine since the DB is created and all records are indexed. However, when I attempt to read from the DB using JdbcPagingItemReader and write to a file I only get the number of records specified in pageSize . So if the pageSize is 10, then I get a file with 10 lines and the rest of the records seem to be ignored. So far, I haven't

Hive Metastore is not creating MYSQL or Derby Connection

丶灬走出姿态 提交于 2019-12-08 05:48:40
问题 Hive Metastore is not creating MYSQL or Derby Connection. For Derby schematool -dbType derby -initSchema Metastore connection URL: jdbc:mysql://localhost/metastore Metastore Connection Driver : com.mysql.jdbc.Driver Metastore connection User: hive schematool -dbType derby -info Metastore connection URL: jdbc:mysql://localhost/metastore Metastore Connection Driver : com.mysql.jdbc.Driver Metastore connection User: hive org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver *

Hibernate Creating Unwanted Mapping Tables

ぐ巨炮叔叔 提交于 2019-12-08 05:44:28
问题 I am creating a schema. My schema is as follows @Entity @Table(name = "PROMOTION") public class Promotion { @Id @Column (name = "promotion_id") private String promotionId; @JoinColumn(name = "seller_id") private List<Seller> sellerList; }; @Entity @Table(name = "SELLER") public class Seller { @Id @Column (name = "seller_id") private String sellerId; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "promotion_id") private Promotion promotion; @ManyToMany(fetch = FetchType.LAZY)

Loading derby.war (derby servlet server) before other web applications in Tomcat

孤街醉人 提交于 2019-12-08 03:11:25
Apache Derby has an option to run its "Network Server" as a web application in a servlet container ( derby.war ). The problem is then how to deploy other applications that depend on derby in the same container to load after derby loads (preferable in a Tomcat container). From what I recall there is no way to control the order of web application initialization in Tomcat. Has anybody gotten derby.war to work in a multiple web application environment? You'll probably find it easier and more reliable to run the Network Server in a separate standalone process of its own, rather than as part of the