SQL: Cannot find database driver: com.microsoft.sqlserver.jdbc.SQLServerDriver

tiborko8 years ago

Hi! I am trying to configure Traccar to use MS SQL server. I configured it as you suggested. In the wrapper file I get an error message saying:

Cannot find database driver: com.microsoft.sqlserver.jdbc.SQLServerDriver

Can you please help? Thank you in advance!

This is what my wrapper.log file looks like:

INFO   | jvm 1    | 2016/10/31 11:50:05 | [Thread-15] INFO org.eclipse.jetty.server.ServerConnector - Stopped ServerConnector@42857e6d{HTTP/1.1}{0.0.0.0:8082}
INFO   | jvm 1    | 2016/10/31 11:50:05 | [Thread-15] INFO org.eclipse.jetty.server.handler.ContextHandler - Stopped o.e.j.s.ServletContextHandler@704fabd3{/api,null,UNAVAILABLE}
STATUS | wrapper  | 2016/10/31 11:50:05 | <-- Wrapper Stopped
STATUS | wrapper  | 2016/10/31 11:50:06 | --> Wrapper Started as Service
STATUS | wrapper  | 2016/10/31 11:50:06 | Java Service Wrapper Community Edition 64-bit 3.5.27
STATUS | wrapper  | 2016/10/31 11:50:06 |   Copyright (C) 1999-2015 Tanuki Software, Ltd. All Rights Reserved.
STATUS | wrapper  | 2016/10/31 11:50:06 |     http://wrapper.tanukisoftware.com
STATUS | wrapper  | 2016/10/31 11:50:06 | 
STATUS | wrapper  | 2016/10/31 11:50:06 | Launching a JVM...
INFO   | jvm 1    | 2016/10/31 11:50:07 | WrapperManager: Initializing...
INFO   | jvm 1    | 2016/10/31 11:50:08 | [MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging.
INFO   | jvm 1    | 2016/10/31 11:50:08 | [WrapperSimpleAppMain] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp: 
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: Encountered an error running main:
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:247)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:151)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:140)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at org.traccar.database.DataManager.initDatabaseSchema(DataManager.java:160)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at org.traccar.database.DataManager.<init>(DataManager.java:67)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at org.traccar.Context.init(Context.java:121)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at org.traccar.Main.main(Main.java:29)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at java.lang.reflect.Method.invoke(Unknown Source)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:325)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at java.lang.Thread.run(Unknown Source)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: Caused by: java.lang.RuntimeException: Cannot find database driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:199)
INFO   | jvm 1    | 2016/10/31 11:50:09 | WrapperSimpleApp Error: 	... 12 more
STATUS | wrapper  | 2016/10/31 11:50:11 | <-- Wrapper Stopped

Also, this is what my traccar config file looks like (I replaced the user and password with ZZZ):

    ...

    <entry key='database.driverFile'>C:\Program Files (x86)\Traccar\lib\sqljdbc4.jar</entry>
    <entry key='database.driver'>com.microsoft.sqlserver.jdbc.SQLServerDriver</entry>
    <entry key='database.url'>jdbc:sqlserver://localhost;user=EDDIE2\ZZZ;password=ZZZ;databaseName=udgps;</entry>
    <entry key='database.user'>EDDIE2\ZZZ</entry>
    <entry key='database.password'>ZZZ</entry>

    ...
Anton Tananaev8 years ago

The error is pretty clear. Database driver file seems to be missing.

tiborko8 years ago

Anton, thank you. Since then I installed the new version of Traccar. Now I am getting an error saying that Login Failed for User. I am sure I have the correct User and Password. I made sure both SQL and Windows authentication is enabled.

Any suggestions?

  1. If the SQL server is on the same host, what should be the name of the server listed in the config file? localhost, 127.0.0.1 or the IP address?
  2. Does the admin login name need to have the server name before it? Like EDDIE2\ZZZ
Anton Tananaev8 years ago

Use SQL user, not Windows user.

  1. You can use either, but "localhost" is the best option.

  2. No, you don't need server name. As I said before, use SQL user, not Windows user.

tiborko8 years ago

Thank you!