Snigdha Solanki

Ranch Hand
+ Follow
since Sep 07, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Snigdha Solanki

Hi,

I am writing a java program that reads the content from a secured site.
It is successfully able to open a URL connection but is not able to read the content type and the length and gives the following exception -

Computed URL is https://www.google.com
Content-type = null
Content-length = -1
javax.net.ssl.SSLException: error while writing to socket
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
at java.io.OutputStream.write(OutputStream.java:58)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:1082)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:663)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:1122)
at java.net.URLConnection.getContentType(URLConnection.java:381)
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl.getContentType(DashoA6275)
at UseHttps.main(UseHttps.java:80)

Code snippet -



Any idea as to what is going wrong?

thanks,
Snigdha
I want to download a word document from an https site. Currently, I am doing it manually and the steps involved are:
1.Connect to the site
2.Login using user name and password
3.This opens a web page wherein it asks for a few details like date etc
4.After entering data I click on the download button to get the document

Is there a way to do all that programmatically?

thanks in advance,
Snigdha
My classes are being compiled into a package. But it uses a class which is not in a package (ie: no package statement). I have set the class path correctly so as to point to the directory containing the class file but still the compiler is not able to find that class. Is there a way to access this class that has no package from a packaged class?
22 years ago
The site does not show any test center in India
Hi,
I am located in Mumbai, India and want to take IBM 486 exam . Can anyone tell me if there are any test centers for that in Mumbai and what will be the cost of the exam.
thanks
1.Do you have windows on your home computer? You can create a .bat file and keep the code which executes your code in it.
java name_of_class_file
Or else you can create an executable jar file(Please refer to Sun's tutorial for that) and put the code to execute the jar file in the .bat file.
java -jar name_of_jar_file
2.You can use ResultSet's previous() method to move the cursor to the previous row. But this will work only if the fetch direction is set properly in the Statement object. The default value is ResultSet.FETCH_FORWARD. Use setFetchDirection() to set it to ResultSet.FETCH_REVERSE or ResultSet.FETCH_UNKNOWN.
22 years ago
Unfortuantely, there is no such method available in Java API. Either you use count(*) to get the row count or if you want to know the no of records after query is executed, keep a counter variable and increment it before your while loop ends for each record.
Is your stored procedure expected to return
anything? execute (of Statement) may return multiple results.It will return true if the next result is a ResultSet object and false if it is an update count or there are no more results.
In sybase (TSQL),"BEGIN TRANSACTION" and "COMMIT TRANSACTION" is used for transaction control.
Are these two statements valid for Oracle, Informix or any other DB also?
Actually the problem is that for managing transcations I was using JDBC methods - setAutoCommit(),rollback() and commit(). But it caused some conflict with stored procedure setting. The DBA is asking me to use "BEGIN TRANSACTION" and "COMMIT TRANSACTION" instead.
Statement.executeUpdate("BEGIN TRANSACTION");
But will this not make by code Database dependent? The advantage of using JDBC is that you can change the DB layer without affecting the code. I am not sure but if I put these statements in my code, will it not make it sybase specific?
I will appreciate an early reply on this.
[ September 04, 2002: Message edited by: Snigdha Solanki ]
[ September 04, 2002: Message edited by: Snigdha Solanki ]
Regarding question 2 it depends on the database. Sybase for example has auto-commit mode as true by default. To check the current auto-commit state, you can use method getAutoCommit() of Connection interface. commit() method of Connection makes all changes since the previous rollback/commit permanent.
I don't think it is possible in the current version of JSDK. There is an article on Sun Java site regarding Swing API changes for JSDK 1.4 version. Do check the section on JFileChooser.
22 years ago
I guess so though I have never tried it. Are you getting any error?
22 years ago
Not sure if I understood your problem.It is possible to set a File as read-only by calling setReadOnly() of File. Is that what you are looking for?
22 years ago
Does anyone know how to do this in java? In C/C++ it is possible to do it with getchar(). InputStream's read()method blocks until the user types the <return> key at the end of a line, at which point the whole line is available for read().
22 years ago
The reason for this behaviour is because of different ways OS interprets "Enter" key. On Unix, it is <LF> (Line Feed); on DOS, it is <CR>+<LF>(Carriage Return + Line Feed) and on Macintosh, it is <CR>.
Check out the below program. It should work on both Windows and Unix though I have not tested it.

where 10 is the Ascii value of LF.
22 years ago