The application of the defendant for an order directing the plaintiff to appear and submit to an examination before trial, as a witness.on behalf of the defendant, was made on notice to plaintiff’s attorneys,.and on the hearing affidavits were read on both sides. The court was therefore in *291the position in which it would have been it an order for the examination had been previously granted ex parte, and the plaintiff had moved, on affidavits and on notice to the defendant, for the vacation of the order. In such a case it has been, ever since the decision of Levy v. Loeb, 44 N. Y. Super. Ct. 291, affirmed 75 N. Y. 609, the practice of this court to require that the papers in support of the application shall fully establish, by facts and circumstances, the necessity and materiality of the examination sought, and the good faith •of the application, and then to exercise a sound discretion as to whether, upon all the facts disclosed, the examination shall or shall not be had. This practice is also sanctioned by the decision of the court of appeals in Jenkins v. Putnam, 106 N. Y. 272, 12 N. E. Rep. 613. Of still greater importance is the question of jurisdiction whenever the power of the court is challenged in an important particular. In the case at bar it was shown in the moving affidavit, as well as by the affidavit read in opposition, that the plaintiff is not si resident of this state, butresides in or near Riceville, in the state of Virginia. It was also shown by the opposing affidavit that the plaintiff has not been within this state since the commencement of the action, and that he does not intend to come here before trial, if then. Section 873, Code Civil Proc., expressly provides that service of the order for the examination of a party must be made within this state; and section 886 prescribes that, if the person to be examined is a resident of the state, he shall not be required to attend in any ■county other than that in which he resides, or where he has an office for the regular transaction of business in person; and that, if he is nota resident,he .shall not be required to attend in any other county than that wherein he is served with a subpoena, unless, for special reasons stated in the affidavit, the ■order otherwise directs. The court possesses no inherent power to order the ■examination of a party before trial, at the instance of an adverse party. The jurisdiction is purely statutory, and depends solely upon the provisions of the Code. Whenever, therefore, it is made to appear that the party sought to be examined is a non-resident, the court may require proof of the ability of the .applicant to make service of the order within the state, and, in the absence of such proof, the court may decline to make what appears to be a useless order. In the present case no such proof was adduced, and, moreover, it affirmatively .appeared that service of the order cannot be made within the state. Irrespective, therefore, of the question of the good or the bad faith of the application, ■the order was properly refused for the reason stated. If it had been made ex parte, and the plaintiff had moved for its vacation upon affidavit showing that he is a non-resident, and that service cannot be made upon him in this .state, the court would have been bound to vacate it under the decision of the general term of this court in Dunham v. Insurance Co., 44 N. Y. Super. Ct. 387, 6 Abb. N. C. 70. Títere is no power in the court to require the plaintiff, as a resident of another state, to come to Eew York from such state, for the sole purpose of being examined. The case of Dudley v. Publishing Co., 6 N. Y. Supp. 388, does not call for a different conclusion. It does not appear that liudley was shown to be a non-resident. The claim was that he had left the state of Eew York, and thus prevented service of the order. Moreover, he had not moved to vacate the order for his examination which had been granted ex parte. It was for these reasons that the order denying ■the motion of the plaintiff in that case to vacate or limit an order extending the defendant’s time to answer was affirmed, and from the opinion delivered -on that occasion it seems that the court was not.called upon to and did not consider the effect of sections 873 and 886 of the Code of Civil Procedure. The ■order appealed from should be affirmed, with $10 costs and disbursements.