简体   繁体   English

如何修复Java中连接到数据库的网络协议错误(SQLNonTransient)

[英]How to fix network protocol error connecting to database in java (SQLNonTransient)

Problem message is here ; 问题消息在这里;

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).

And also I looked derby log. 我也看了德比日志。 And It says access denied for one of derby files 并说拒绝了一个德比文件访问

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$3.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.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.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$3.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.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.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)

So guys I can connect to database I mean I clicked to connect and it seemed me like connected and I can see tables but I cant view datas on database. 伙计们,我可以连接到数据库,我的意思是我单击了连接,看来我很喜欢连接,可以看到表,但无法查看数据库中的数据。 I searched on Internet a while but still same I couldnt find a solution. 我在互联网上搜索了一段时间,但仍然找不到解决方案。 2 days ago I updated netbeans and then it started to not working :) 2天前,我更新了netbeans,然后开始不起作用:)

I did something and It works now . 我做了一些,现在可以了。 I have no idea why but I will tell you what I did. 我不知道为什么,但是我会告诉你我做了什么。

Firstly I got my database file path on netbeans 首先,我在netbeans上获得了数据库文件路径

C:\\Users\\bilal.harmansa.netbeans-derby C:\\ Users \\ bilal.harmansa.netbeans-derby

After that I copied to ".netbeans-derby" to D:\\ after that I changed path in netbeans.(NetBeans>Services>JavaDB right click properties > Database Location 之后,我将“ .netbeans-derby”复制到D:\\,然后更改了netbeans中的路径。(NetBeans>“服务”> JavaDB右键单击“属性”>“数据库位置”

I changed as D:\\ .netbeans-derby. 我将其更改为D:\\ .netbeans-derby。

I closed netbeans and open it again. 我关闭了netbeans,然后再次打开。 I tried to connect it gived me some red lines but it connected and I could see my datas. 我尝试连接它给了我一些红线,但是它连接了,我可以看到我的数据了。 After that I went to original path which is C:\\Users\\bilal.harmansa.netbeans-derby 之后,我转到了原始路径,即C:\\ Users \\ bilal.harmansa.netbeans-derby

I deleted .netbeans-derby. 我删除了.netbeans-derby。 After that I copied .netbeans-derby in driver D:\\ and I pasted to 之后,我在驱动程序D:\\中复制了.netbeans-derby,并将其粘贴到

C:\\Users\\bilal.harmansa\\ . C:\\ Users \\ bilal.harmansa \\。

Lastly went netbeans and set database location as original.(We changed it as D:.netbeans-derby) it should be 最后进入netbeans并将数据库位置设置为原始位置(我们将其更改为D:.netbeans-derby)

C:\\Users\\bilal.harmansa.netbeans-derby C:\\ Users \\ bilal.harmansa.netbeans-derby

again. 再次。

Thats it. 而已。 Probably it works now if you have same problem. 如果您遇到同样的问题,现在可能可以正常工作。 Mine was saying cant read an a file cause of access denied. 我的意思是无法读取文件导致访问被拒绝。 I hope you can fix your problem too :) 我希望您也可以解决您的问题:)

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

相关问题 如何解决:连接到本地主机时出错:Java中的连接被拒绝 - How to fix: Error connecting to localhost: Connection Refused in Java 使用Java应用程序通过网络连接到数据库 - connecting to database through network using java application 获取'java.sql.SQLRecoverableException:IO错误:网络适配器无法建立连接',同时连接oracle数据库 - Getting 'java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection' while connecting oracle database Java连接到MySQL数据库错误 - Java Connecting to a MySQL database error 用Java连接到MySQL数据库错误 - Connecting to MySQL database error in Java 如何在Java中更有效地管理网络协议 - how to more efficiently manage network protocol in java 从spring boot应用程序连接到oracle数据库时如何解决“驱动程序不支持获取/设置连接网络超时”的问题? - How to fix "Driver does not support get/set network timeout for connections" while connecting to oracle database from spring boot app? 使用Java的FIX协议 - FIX protocol using java 将数据库连接到NetBeans中的Java程序时出错 - error connecting database to java program in netbeans 使用Java连接mysql数据库时出错 - Error with connecting mysql database using java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM