Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating to SQL Server in TeamCity: A driver for the source database not found

I'm trying to move my TeamCity instance to SQL Server. I followed the instructions in the docs for Setting up an External Database.

Now I'm going through Migrating to an External Database and running the maintainDb command:

.\maintainDB.cmd migrate -A c:\users\jkodroff\.buildserver -T C:\Users\jkodroff\.BuildServer\config\database.properties

And I get this output:

Java executable is found: 'C:\Program Files\Java\jdk1.6.0_35\bin\java.exe'.
Using logs directory C:\TeamCity\logs
TeamCity maintenance tool. Copyright 2013 JetBrains s.r.o. All Rights Reserved.

Command line arguments: migrate -A c:\users\jkodroff\.buildserver -T C:\Users\jkodroff\.BuildServer\config\database.properties
Using TeamCity data directory: C:\Users\jkodroff\.BuildServer
Using database settings from the TeamCity data directory for source database: C:\Users\jkodroff\.BuildServer\config\database.properties
Using source database
        database type: MSSQL
        connection string: jdbc:jtds:sqlserver://localhost:1433/teamcity
Cannot proceed with 'migrate' command: A driver for the source database not found. Please ensure you have driver jars in C:\Users\jkodroff\.BuildServer\lib\jdbc.
Critical error has occurred during command execution.

I've verified that both sqljdbc.jar and sqljdbc4.jar are in the directory indicated, so what gives?

like image 711
Josh Kodroff Avatar asked Feb 13 '23 14:02

Josh Kodroff


1 Answers

The fact that you have sqljdbc.jar and sqljdbc4.jar indicates that you are using the Microsoft SQL Server JDBC Driver, but the connection string is for the jTDS driver. Make sure you use the correct connection string for the Microsoft SQL Server JDBC or that you use the jTDS JDBC driver instead.

Second: you should use either sqljdbc.jar (which is for Java 5) or sqljdbc4.jar (which is for Java 6 and later), not both; loading both might lead to unexpected behavior due to classloading order etc!

like image 119
Mark Rotteveel Avatar answered Feb 16 '23 16:02

Mark Rotteveel