简体   繁体   English

在使用GlassFish 4.1安装NetBeans 8.0.2之后,无法连接到示例数据库

[英]After Installing NetBeans 8.0.2 with GlassFish 4.1 Cannot Connect to sample Database

I installed NetBeans 8.0.2 with glassfish-4.1. 我在glassfish-4.1上安装了NetBeans 8.0.2。 The sample folder is present under C:\\Users\\Username.netbeans-derby. 示例文件夹位于C:\\ Users \\ Username.netbeans-derby下。 When I bring up NetBeans and go to the Services tab the connection to sample is present: jdbc:derby://localhost:1527/sample [app on APP] but sample is not listed under Java DB so when I try to connect to sample I get the following error "Unable to connect. Cannot establish a connection to jdbc:derby://localhost1527/sample using org.apache.derby.jdbc.ClientDriver (The connection was refused becuase the database sample was not found)." 当我启动NetBeans并转到“服务”选项卡时,存在与示例的连接:jdbc:derby:// localhost:1527 / sample [APP上的应用],但示例未在Java DB下列出,因此当我尝试连接至示例时我收到以下错误“无法连接。无法使用org.apache.derby.jdbc.ClientDriver建立到jdbc:derby:// localhost1527 / sample的连接(该连接被拒绝,因为找不到数据库示例)。”

Right click on Java DB select Create Database . 右键单击Java DB选择“ Create Database

  • use as Database Name 'sample' 用作Database Name “样本”
  • use as User Name 'app' 用作用User Name “ app”
  • leave the password empty 将密码留空

edit Seems there is a broken database or maybe one from an earlier Netbeans installation. 编辑似乎有一个损坏的数据库,或者可能是来自较早NetBeans安装的数据库。 Remove the sample connection in Netbeans and remove the directory %USERPROFILE%\\.netbeans-derby\\sample . 删除Netbeans中的sample连接,并删除目录%USERPROFILE%\\.netbeans-derby\\sample Recreate the sample database as described above. 如上所述,重新创建sample数据库。

I had a broken database from an earlier version too, and then couldn't connect to the sample db. 我也有一个来自早期版本的损坏的数据库,然后无法连接到示例数据库。 I simply had to delete the .netbeans-derby directory, then reinstalled Netbeans, and is was ok, then. 我只需要删除.netbeans-derby目录,然后重新安装Netbeans,就可以了。

The same thing happened to me and re-installing NetBeans did not help. 我也发生了同样的事情,重新安装NetBeans没有帮助。 After poking around the databases for a bit, I finally got mine working using the following process. 在数据库中闲逛了一会之后,我终于使用以下过程使我的工作得以完成。

  1. Create a new database with any properties (ie name, user, pw) 创建具有任何属性(即名称,用户,密码)的新数据库
  2. Navigate to your user directory \\.netbeans-derby\\{name}\\ 导航到您的用户目录\\ .netbeans-derby \\ {name} \\
  3. Copy service.properties file and paste in \\.netbeans-derby\\sample\\ 复制service.properties文件并粘贴到\\ .netbeans-derby \\ sample \\
  4. Reconnect to sample database in NetBeans 重新连接到NetBeans中的示例数据库

A couple extra notes: 几个额外的注意事项:

  • If you configured your NetBeans database to a different location, use that location in step 2. 如果您将NetBeans数据库配置为其他位置,请在步骤2中使用该位置。
  • You may need to delete and re-create the existing sample database connection in NetBeans for it to pickup the new service.properties file. 您可能需要删除并重新创建NetBeans中的现有示例数据库连接,以使其能够拾取新的service.properties文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM