如何创建如果不存在一个新的Java DB? [英] how to Create if not exists a new Java DB?

查看:143
本文介绍了如何创建如果不存在一个新的Java DB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 conn = DriverManager.getConnection("jdbc:derby:mydatabase;create=true",props);

这行会使我的DB每次执行时都被覆盖吗?

will this line make my DB get overwritten everytime i execute it? if it will how do i create the DB once and just use it ever since?

推荐答案

您正在做什么将与Derby一起使用。如果它不存在,它将创建数据库,如果它已经存在,则不做任何操作。

What you are doing will work with Derby. It will create the database if it doesn't exist and do nothing if it already does exist.

这篇关于如何创建如果不存在一个新的Java DB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆