How to make Java work with SQL Server?

前端 未结 9 1442
别那么骄傲
别那么骄傲 2020-12-13 06:23

I know this is a basic question, but I can\'t seem to find an answer and I apologize, if this question is way too stupid, but here we go:

I am supposed to work with

9条回答
  •  悲哀的现实
    2020-12-13 07:10

    Maybe a little late, but using different drivers altogether is overkill for a case of user error:

    db.dbConnect("jdbc:sqlserver://localhost:1433/muff", "user", "pw" );
    

    should be either one of these:

    db.dbConnect("jdbc:sqlserver://localhost\muff", "user", "pw" );
    

    (using named pipe) or:

    db.dbConnect("jdbc:sqlserver://localhost:1433", "user", "pw" );
    

    using port number directly; you can leave out 1433 because it's the default port, leaving:

    db.dbConnect("jdbc:sqlserver://localhost", "user", "pw" );
    

提交回复
热议问题