How can I check if DatabaseLink`OpenSQLConnection was successful? My code is as follows
conn = OpenSQLConnection[JDBC["hsqldb", "file"], "Name"-> "test"];
Can I use something like Head[conn]?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The return value for successful connection will have head
SQLConnection(in theDatabaseLinkcontext)More generally:
OpenSQLConnectionreturns$Failedwhen the connection failed for whatever reason:… and unevaluated when its arguments were not of the proper form:
Therefore, you can look for a return value of
$Failedand optionally also useCheck[...]to trap and handle messages that were generated. As you guessed, you can useHead[returnvalue]to make sure the head of the return value does not equalOpenSQLConnection.