I am a beginner in java programming. I am trying to read response from url and insert it into database. I ran my program which is posted below and it came back with this error:
I have been trying to solve this issue on my own through research, but I could not solve it. I was wondering if anyone can help me. If you do need any other information about my program, please just ask. Thanks in advance!
In future, while posting code, please UseCodeTags I have added them this time for you. As you can see the tags make the code much more easier to read and understand
the static variable input is null. When passed to the parseResponseString method, the NullPointerException is thrown on the line:
because input is null.
From looking at the whole class, I think you think you are setting the input variable here:
But you are not as you had declared a local variable called input on line 5 of the snippet above. This is used and then discarded once this method completes.
thanks a lot it helped but now i am getting new errors,sorry but i really am new to java please help
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at javaapp.JavaApplication1.insertToDatabase(JavaApplication1.java:61)
at javaapp.JavaApplication1.main(JavaApplication1.java:78)
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:386)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
... 8 more