Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
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".
⇒ jTDS JDBC Driver Connection URL String
⇐ jTDS JDBC Driver in Java Database Connection Architecture
2017-02-03, 2311🔥, 0💬
Popular Posts:
JDK 11 java.management.jmod is the JMOD file for JDK 11 Management module. JDK 11 Management module ...
How to download and install ojdbc6.jar for Oracle 11g R2? ojdbc6.jar for Oracle 11g R2 is a Java 6, ...
What Is commons-fileupload-1.3.3 .jar?commons-fileupload-1.3.3 .jaris the JAR file for Apache Common...
What Is ojdbc7.jar for Oracle 12c R1? ojdbc7.jar for Oracle 12c R1 is the JAR files of ojdbc.jar, JD...
How to read XML document with XML Schema validation from socket connections with the socket\DelayedI...