Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你这个报错用不了连接不了数据库 #1

Open
Heyxiang opened this issue Jan 8, 2018 · 0 comments
Open

你这个报错用不了连接不了数据库 #1

Heyxiang opened this issue Jan 8, 2018 · 0 comments

Comments

@Heyxiang
Copy link

Heyxiang commented Jan 8, 2018

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at test.DBTrain.setCurrentModel(DBTrain.java:110)
at test.TrainTime.keyReleased(TrainTime.java:956)
at java.awt.AWTEventMulticaster.keyReleased(AWTEventMulticaster.java:259)
at java.awt.Component.processKeyEvent(Component.java:6494)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2832)
at java.awt.Component.processEvent(Component.java:6310)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954)

//加载JDBC-ODBC桥驱动类 这里怎么配置
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url="jdbc:sqlserver://localhost:1433;DatabaseName=Train.mdb";
//创建数据库连接
Connection con = DriverManager.getConnection(url,"sb","sb");

  • @Jackzzl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant