java - I am using Microsoft SQL Server 2014 and NetBeans 8.0.2 - getConnection always underlined RED -
i'm hoping can me?
i'm working on application programmed in netbeans 8.0.2 , have sql server 2014 backend database application.
i trying netbeans app talk sql database app , although feel have run processes of creating linking etc. correctly, cannot getconnection state apart underlined red.
any , appreciated.
i have added call below:
connection con = null; try { class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver"); con = drivermanager.getconnection("jdbc:sqlserver://localhost:1433;databasename=keyprop","sa"); system.out.println("connected"); } catch(classnotfoundexception e) { system.out.println("class not found exception :" + e.getmessage()); }
thanks, don
the problem trying call getconnection
method not exist (getconnection(string, string)
).
you have following choices:
getconnection(string url)
getconnection(string url, properties info)
getconnection(string url, string user, string password)
so solution use
getconnection("jdbc:sqlserver://...", "sa", "your-sa-password)
Comments
Post a Comment