Categories:
Audio (13)
Biotech (29)
Bytecode (22)
Database (79)
Framework (7)
Game (7)
General (497)
Graphics (53)
I/O (32)
IDE (2)
JAR Tools (70)
JavaBeans (16)
JDBC (86)
JDK (338)
JSP (20)
Logging (90)
Mail (54)
Messaging (8)
Network (106)
PDF (82)
Report (7)
Scripting (75)
Security (67)
Server (112)
Servlet (17)
SOAP (24)
Testing (55)
Web (24)
XML (287)
Other Resources:
ShowJdbcDrivers.java - jTDS JDBC Driver Example
How to verify if jTDS JDBC Driver is loaded corrected from the classpath? I want to see a Java program example.
✍: FYIcenter.com
Here is an example program, ShowJdbcDrivers.java, that can be used to
verify if jTDS JDBC Driver is loaded corrected from the classpath or not:
// Copyright (c) 2016 FYIcenter.com import java.sql.DriverManager; import java.sql.Driver; import java.util.Enumeration; // Example show all JDBC drivers loaded in the classpath public class ShowJdbcDrivers { public static void main(String [] args) throws Exception { System.out.println("Loaded JDBC driver classes:"); for (Enumeration<Driver> drivers=DriverManager.getDrivers(); drivers.hasMoreElements(); ) { System.out.println(drivers.nextElement().getClass().getName()); } } }
You can compile and run the above example in a command window as shown below:
C:\fyicenter>\local\jdk-1.8.0\bin\javac -cp C:\local\jtds-1.3.1\jtds-1.3.1.jar ShowJdbcDrivers.java C:\fyicenter>\local\jdk-1.8.0\bin\java -cp .;C:\local\jtds-1.3.1\jtds-1.3.1.jar ShowJdbcDrivers Loaded JDBC driver classes: net.sourceforge.jtds.jdbc.Driver
If you run the example again with a typo in the classpath, you will not see the jTDS JDBC driver class in the output:
C:\fyicenter>\local\jdk-1.8.0\bin\java -cp .;C:\local\jtds-1.3.1\jtds-1.3.l.jar ShowJdbcDrivers Loaded JDBC driver classes:
By the way, the typo is in the jTDS JDBC driver JAR file name. It should be "jtds-1.3.1.jar" instead of "jtds-1.3.l.jar".
2017-02-03, 1666👍, 0💬
Popular Posts:
What Is ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is the JAR files of ojdbc.jar, JD...
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.1? The if you...
JSP(tm) Standard Tag Library 1.1 implementation - Jakarta Taglibs hosts the Standard Taglib 1.1, an ...
Java Cryptography Extension 1.6 JAR File Size and Download Location: File name: jce.jar, jce-1.6.jar...
Apache Axis2 is the core engine for Web services. It is a complete re-design and re-write of the wid...