简体   繁体   中英

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

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

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

I changed as D:\\ .netbeans-derby.

I closed netbeans and open it again. 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

I deleted .netbeans-derby. After that I copied .netbeans-derby in driver D:\\ and I pasted to

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

Lastly went netbeans and set database location as original.(We changed it as D:.netbeans-derby) it should be

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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