Apache Derby-创建数据库但未找到 [英] Apache Derby - Database created but not found

查看:64
本文介绍了Apache Derby-创建数据库但未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我之前的


This is in continuation to my previous question

I'm trying to embed a derby database in my web application. I'm able to embed it, though I am facing glitches. Here's the snapshot of my project structure.

I wonder why class.forName("org.apache.derby.jdbc.EmbededDriver") is throwing exception?

java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbededDriver

To overcome this, I have used

DriverManager.registerDriver(new org.apache.derby.jdbc.EmbeddedDriver());

Which works well. Why is it so? Also, Where would it create database if coded like this. I cannot spot the database.

connection = DriverManager.getConnection("jdbc:derby:MyDbTest;create=true");

I checked in tomcat webapps and eclipse workspace, I didn't find database.

If given this way, I can spot it.

connection = DriverManager.getConnection("jdbc:derby:E:/MyDbTest;create=true");

解决方案

class.forName("org.apache.derby.jdbc.EmbededDriver")

Threw an exception because there is a 'd' missing from embedded.

See here for information about specifying the location of databases on the file system.

connecting to a file-based derby database

这篇关于Apache Derby-创建数据库但未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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