如何修复 java 中连接到数据库的网络协议错误 (SQLNonTransient)
How to fix network protocol error connecting to database in java (SQLNonTransient)
问题消息在这里;
Java.sql.SQLNonTransientConnectionException: A network protocol error was encountered and the connection has been terminated:The requested command encountered an unarchitected and implementation-specific condition for which there was no architected message (additional information may be available in the derby.log file on the server).
我还查看了德比日志。它说对其中一个德比文件的访问被拒绝
ava.sql.SQLNonTransientConnectionException: A network protocol error was encountered and the connection has been terminated: The requested command encountered an unarchitected and implementation-specific condition for which there was no architected message (additional information may be available in the derby.log file on the server).
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.ClientStatement.executeQuery(Unknown Source)
at habersitesihabertakibi.SQLCommand.select(SQLCommand.java:43)
at habersitesihabertakibi.Site.getKullaniciSayisi(Site.java:423)
at habersitesihabertakibi.GirisPaneli.<init>(GirisPaneli.java:36)
at habersitesihabertakibi.GirisPaneli.run(GirisPaneli.java:234)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access0(EventQueue.java:97)
at java.awt.EventQueue.run(EventQueue.java:709)
at java.awt.EventQueue.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: ERROR 08006: A network protocol error was encountered and the connection has been terminated: The requested command encountered an unarchitected and implementation-specific condition for which there was no architected message (additional information may be available in the derby.log file on the server).
at org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
at
org.apache.derby.client.am.ClientStatement.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.am.ClientStatement.flowExecute(Unknown Source)
at org.apache.derby.client.am.ClientStatement.executeQueryX(Unknown Source)
... 19 more
Caused by: ERROR XSDG3: DERBY SQL error: ERRORCODE: 45000, SQLSTATE: XSDG3, SQLERRMC: Meta-data for unknown could not be accessed to read C:\Users\bilal.harmansa\.netbeans-derby\habersitesitakibi\seg0\c860.dat::SQLSTATE: XJ001
... 28 more
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at habersitesihabertakibi.Site.getKullaniciSayisi(Site.java:426)
at habersitesihabertakibi.GirisPaneli.<init>(GirisPaneli.java:36)
at habersitesihabertakibi.GirisPaneli.run(GirisPaneli.java:234)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access0(EventQueue.java:97)
at java.awt.EventQueue.run(EventQueue.java:709)
at java.awt.EventQueue.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(E
ventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
BUILD STOPPED (total time: 5 minutes 1 second)
伙计们,我可以连接到数据库我的意思是我点击连接,看起来我已经连接了,我可以看到表格,但我无法查看数据库中的数据。我在互联网上搜索了一段时间,但仍然找不到解决方案。 2 天前我更新了 netbeans 然后它开始不工作:)
我做了一些事情,现在可以了。我不知道为什么,但我会告诉你我做了什么。
首先我在 netbeans 上得到了我的数据库文件路径
C:\Users\bilal.harmansa.netbeans-德比
之后我将“.netbeans-derby”复制到 D:\ 之后我更改了 netbeans 中的路径。(NetBeans>服务>JavaDB 右键单击属性>数据库位置
我改成D:\.netbeans-derby.
我关闭了 netbeans 并再次打开它。我试图连接它给了我一些红线但它连接了并且我可以看到我的数据。之后我去了原来的路径
C:\Users\bilal.harmansa.netbeans-德比
我删除了 .netbeans-derby。之后,我将 .netbeans-derby 复制到驱动程序 D:\ 中,然后粘贴到
C:\Users\bilal.harmansa\ 。
最后去 netbeans 并设置数据库位置为原始位置。(我们将其更改为 D:.netbeans-derby)它应该是
C:\Users\bilal.harmansa.netbeans-德比
又一次。
就是这样。如果您有同样的问题,它现在可能会起作用。我的是说无法读取文件导致访问被拒绝。我希望你也能解决你的问题:)
问题消息在这里;
Java.sql.SQLNonTransientConnectionException: A network protocol error was encountered and the connection has been terminated:The requested command encountered an unarchitected and implementation-specific condition for which there was no architected message (additional information may be available in the derby.log file on the server).
我还查看了德比日志。它说对其中一个德比文件的访问被拒绝
ava.sql.SQLNonTransientConnectionException: A network protocol error was encountered and the connection has been terminated: The requested command encountered an unarchitected and implementation-specific condition for which there was no architected message (additional information may be available in the derby.log file on the server).
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.ClientStatement.executeQuery(Unknown Source)
at habersitesihabertakibi.SQLCommand.select(SQLCommand.java:43)
at habersitesihabertakibi.Site.getKullaniciSayisi(Site.java:423)
at habersitesihabertakibi.GirisPaneli.<init>(GirisPaneli.java:36)
at habersitesihabertakibi.GirisPaneli.run(GirisPaneli.java:234)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access0(EventQueue.java:97)
at java.awt.EventQueue.run(EventQueue.java:709)
at java.awt.EventQueue.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: ERROR 08006: A network protocol error was encountered and the connection has been terminated: The requested command encountered an unarchitected and implementation-specific condition for which there was no architected message (additional information may be available in the derby.log file on the server).
at org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
at
org.apache.derby.client.am.ClientStatement.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.am.ClientStatement.flowExecute(Unknown Source)
at org.apache.derby.client.am.ClientStatement.executeQueryX(Unknown Source)
... 19 more
Caused by: ERROR XSDG3: DERBY SQL error: ERRORCODE: 45000, SQLSTATE: XSDG3, SQLERRMC: Meta-data for unknown could not be accessed to read C:\Users\bilal.harmansa\.netbeans-derby\habersitesitakibi\seg0\c860.dat::SQLSTATE: XJ001
... 28 more
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at habersitesihabertakibi.Site.getKullaniciSayisi(Site.java:426)
at habersitesihabertakibi.GirisPaneli.<init>(GirisPaneli.java:36)
at habersitesihabertakibi.GirisPaneli.run(GirisPaneli.java:234)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access0(EventQueue.java:97)
at java.awt.EventQueue.run(EventQueue.java:709)
at java.awt.EventQueue.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(E
ventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
BUILD STOPPED (total time: 5 minutes 1 second)
伙计们,我可以连接到数据库我的意思是我点击连接,看起来我已经连接了,我可以看到表格,但我无法查看数据库中的数据。我在互联网上搜索了一段时间,但仍然找不到解决方案。 2 天前我更新了 netbeans 然后它开始不工作:)
我做了一些事情,现在可以了。我不知道为什么,但我会告诉你我做了什么。
首先我在 netbeans 上得到了我的数据库文件路径
C:\Users\bilal.harmansa.netbeans-德比
之后我将“.netbeans-derby”复制到 D:\ 之后我更改了 netbeans 中的路径。(NetBeans>服务>JavaDB 右键单击属性>数据库位置
我改成D:\.netbeans-derby.
我关闭了 netbeans 并再次打开它。我试图连接它给了我一些红线但它连接了并且我可以看到我的数据。之后我去了原来的路径 C:\Users\bilal.harmansa.netbeans-德比
我删除了 .netbeans-derby。之后,我将 .netbeans-derby 复制到驱动程序 D:\ 中,然后粘贴到
C:\Users\bilal.harmansa\ 。
最后去 netbeans 并设置数据库位置为原始位置。(我们将其更改为 D:.netbeans-derby)它应该是
C:\Users\bilal.harmansa.netbeans-德比
又一次。
就是这样。如果您有同样的问题,它现在可能会起作用。我的是说无法读取文件导致访问被拒绝。我希望你也能解决你的问题:)