Derby类路径无法连接到数据库 [英] Derby classpath can't connect to database

查看:315
本文介绍了Derby类路径无法连接到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了derby,并且按照此处中的说明进行操作和我告诉我的方法完全一样,只是用我的路径替换了路径.但是由于某些原因,为什么我尝试创建一个连接以连接以创建数据库并运行我的sql脚本来创建表并填充它们,所以它首先给了我一些错误

I just installed derby and I followed the instructions from here the exact same way it told me to but replacing the paths with my paths. But for some reason why i try to create a connection to connect to create a Database and run my sql scripts to create the tables and populate them it gives me a few errors firstly is this one

ERROR 08001: No suitable driver found for jdbc:derby:SuperMarket;create=true

然后,当我的sql脚本运行时,出现此错误

Then when my sql scripts run I get this error

IJ ERROR: Unable to establish connection

我看不出我做错了什么,这是我用来设置类路径的行

I dont see what I did wrong this is the line i used to set the class path

C:\> set CLASSPATH=%DERBY_INSTALL%\lib\derby.jar;%DERBY_INSTALL%\lib\derbytools.jar;.

我包括了所需的derby.jar文件,所以我看不到有人知道我做错了什么的问题吗?也是我跑步的时候

I included the derby.jar file that was needed so I can't see the problem does anyone know what I did wrong? Also when I run

 connect 'jdbc:derby://localhost:1527/MyDB';

服务器启动正常

C:\Derbs\db-derby-10.10.2.0-bin\bin>startNetworkServer
Thu Jun 26 11:56:38 PDT 2014 : Security manager installed using the Basic server
 security policy.
Thu Jun 26 11:56:39 PDT 2014 : Apache Derby Network Server - 10.10.2.0 - (158244
6) started and ready to accept connections on port 1527

推荐答案

当我开始使用DerbyDB时会遇到很多麻烦.练习真的很痛苦.

There are many troubles when I start using DerbyDB. It is really painful to practice.

1. 例如,我从

1. For example, I download Derby from http://db.apache.org/derby/derby_downloads.html#Latest+Official+Releases

2..解压缩到C:\tools\db-derby-10.11.1.1-bin.


3..按Windows键+ R ,键入:SystemPropertiesAdvanced,设置环境变量.
参考:
https://db.apache. org/derby/docs/10.0/manuals/getstart/gspr16.html


3. Press Windows key + R, type: SystemPropertiesAdvanced, set up environment variables.
Reference: https://db.apache.org/derby/docs/10.0/manuals/getstart/gspr16.html


4..运行cmd, 我们应该运行其他命令:


4. Run cmd, We should run additional command:

C:\tools\db-derby-10.11.1.1-bin\bin\NetworkServerControl.bat

然后输入:

C:\tools\db-derby-10.11.1.1-bin\bin\ij.bat

然后按 Enter ,结果:


5..我们会将内存Derby数据库放入D:\目录.文件夹vy1 不能退出.我们键入命令以创建名为vy1的新数据库:


5. We will put in-memory Derby database to D:\ directory. Folder vy1 must doesn't exit. We type command for creating new database named vy1:

connect 'jdbc:derby:D:\vy1;create=true';

使用Windows资源管理器,转到目录D:\vy1,您将看到刚刚创建的名为vy1的新文件夹.

Use Windows Explorer, go to directory D:\vy1, you will see new folder named vy1 just created.

然后键入命令:

connect 'D:\vy1'


6..请参见SQL命令来创建数据库,表,进行插入,然后读取数据库,如下所示:


6. See SQL command to create database, table, insert, then read database like this:

(在新网页中打开图像更易于查看.注意:这是我几个月前使用旧版本时的旧屏幕截图).

(Open images in new web page is better for view. Note: This is my old screenshot when I use older version few months ago).

回到您的问题,重点关注第3部分,并建议在第4部分致电NetworkServerControl.bat.

Come back to your question, focus at section 3, and commnand call NetworkServerControl.bat at section 4.

祝你好运! :)

这篇关于Derby类路径无法连接到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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