You can try these steps:
1) Have some where sqljdbc4.jar in your system, from DOS prompt, traverse
to this jar location and create a maven dependency JAR
2) mvn install:install-file -Dfile=sqljdbc4.jar
-DgroupId=com.microsoft.sqlserver.jdbc -DartifactId=sqljdbc4 -Dversion=4.0
-Dpackaging=jar --- you can change values as needed
3) In your project's POM file, define dependency as below
<dependency>
<groupId>com.microsoft.sqlserver.jdbc</groupId>
<artifactId>sqljdbc4</artifactId>
<scope>system</scope>
<version>4.0</version>
<systemPath>${user.home}\.m2\repository\com\microsoft\sqlserver\jdbc\sqljdbc4\4.0\sqljdbc4-4.0.jar</systemPath>
</dependency>
4) If jar file not copied to your project's "work" folder then copy
manually the jar file (sqljdbc4-4.0.jar) - path "\{project artifact
folder}\target\{artifact folder}\WEB-INF\lib\"
--------------If above steps does not workout, then simply copy the
sqljdbc4.jar file to "\{project artifact
folder}target\work\webapp\WEB-INF\lib\" and rerun the job.
On Tuesday, July 31, 2012 7:10:39 PM UTC-4, chewan mak wrote:
>
> Our team need a plugin that can access our local SQL server. I used
> traditional jdbc call
>
> Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();;
> String conStr = "jdbc:sqlserver://myserver;databaseName=Eps"
> con = DriverManager.getConnection(conStr, uId, pswd);
> stmt = con.prepareStatement(sqlStm);
> ResultSet rs = stmt.executeQuery(sqlStm);
>
> An ClassNotFoundException returned to load the class. The class is in a
> sqljdbc4.jar. Unlike regular java console program that I can see the
> CLASSPATH, I do not know how to get this jar loaded. To bypass the problem,
> I tied to put the jar file in [JENKINS_ROOT]/jre/lib, hope it will load,
> with no luck.
>
> Questions:
> 1) Is there a way to set the CLASSPATH where plugin can load it?
> 2) If CLASSPATH cannot be set, where should I put a jar file so that it
> can be found by the loader?
> 3) Is the connection string correct?
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.