问题描述
Statementstat=DB.getConnection().createStatement();这个createStatement()是什么方法?怎么用?
解决方案
解决方案二:
简单点Statementstm=con.createStatement();看方法名字猜也猜到了。。create(建立)statement
解决方案三:
createStatementStatementcreateStatement()throwsSQLExceptionCreatesaStatementobjectforsendingSQLstatementstothedatabase.SQLstatementswithoutparametersarenormallyexecutedusingStatementobjects.IfthesameSQLstatementisexecutedmanytimes,itmaybemoreefficienttouseaPreparedStatementobject.ResultsetscreatedusingthereturnedStatementobjectwillbydefaultbetypeTYPE_FORWARD_ONLYandhaveaconcurrencylevelofCONCUR_READ_ONLY.TheholdabilityofthecreatedresultsetscanbedeterminedbycallinggetHoldability().Returns:anewdefaultStatementobjectThrows:SQLException-ifadatabaseaccesserroroccursorthismethodiscalledonaclosedconnectionjavase文档。。
解决方案四:
你这全是英文看起来好别扭呀,不过你真的想仔细的弄清的话确实得看看API文档,当你创建了一个Connection链接后,得通过这个链接来创建createStatement对象