| |

VerySource

 Forgot password?
 Register
Search
View: 893|Reply: 5

java connect sql

[Copy link]

2

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-6 09:30:01
| Show all posts |Read mode
I use the following method to connect to the database
Class.forName ("com.microsoft.jdbc.sqlserver.SQLServerDriver"). NewInstance ();
String url = "jdbc: microsoft: sqlserver: // localhost: 1433; DatabaseName = mydb";
// mydb is the database
String user = "sa";
String password = "";
Connection conn = DriverManager.getConnection (url, user, password);
Where does the "com.microsoft.jdbc.sqlserver.SQLServerDriver" package come in?
The error message is that this package cannot be found
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-3-26 17:45:01
| Show all posts
Are the three jar packages connected to the SQL server imported?
If you haven't done this, go to Eclipse-> Project-> Properties-> java build path (javapath)-> Library (third label)-> Add external jar file (second option)
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-3-28 17:00:02
| Show all posts
Three Jar packages: msbest.jar, mssqlserver.jar, msutil.jar
Reply

Use magic Report

0

Threads

21

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-5-3 07:45:02
| Show all posts
Some of the Microsoft website
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-12 14:15:01
| Show all posts
Is the jdbc driver installed? The msbest.jar, mssqlserver.jar, msutil.jar packages are placed under jdk.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-21 21:30:01
| Show all posts
Put msbest.jar, mssqlserver.jar, msutil.jar
Copy over
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list