JDBC FAQ
table of Contents
What is JDBC 3.0 API? Does jdbc-odbc bridge support new features in the JDBC 3.0 API? Can jdbc-odbc bridges can be used with Applet? How do I start debugging with the JDBC API? How can I use the JDBC API to access a desktop database like Microsoft Access via the network? What are the available drivers that support JDBC technology? What are the JDBC API documents available? Is there an ODBC driver that cannot work with JDBC-ODBC Bridge? What will cause "No Suitable Driver" (no suitable driver) error? Why can't you find a java.sql.driverManager class? How do I retrieve a strong data in a time, not to call a resultset.getxxx method for each column? Why ODBC Driver Manager returns "Data Source Name Not Found and No Default Driver Specified Vendor: 0" (Data Source Name Did not find and no default driver specifies supplier: 0)? Whether all the required JDBC drivers will create a connection to the JDK database section? Is the jdbc-odbc bridge be multi-threaded? Does jdbc-odbc bridge support multiple concurrent open statements in each connection? When the next method works, why can't I call the ResultSet method AfterLast and BeforeFirst? How can I retrieve a string or other object type, don't have to create a new object each time? There is a method getColumnCount in the JDBC API. Is there a similar way to find the number of rows in the result of the result? I would like to download JAVA 2 SDK, Standard Edition JDBC-ODBC Bridge for JDBC-ODBC Bridge. I am a beginner of JDBC API, I want to start with Bridge. what should I do? If I use the JDBC API, I need to use ODBC Underneath? Once you have Sun's Java 2 SDK, Standard Edition, do you need to do anything else?
1. What is JDBC 3.0 API?
JDBC 3.0 API is the last update of the JDBC API. It contains many features, including scrollable result sets and SQL: 1999 data types.
Back to top
2. Does jdbc-odbc bridge support new features in the JDBC 3.0 API?
JDBC-ODBC Bridge provides a limited subset of JDBC 3.0 APIs.
Back to top
3. Can jdbc-odbc bridges can be used with Applet?
Untrusted Applets running in a browser (such as Netscape Navigator) are not allowed to use JDBC-ODBC Bridge. JDBC-ODBC Bridge does not allow untrusted code to call it for security considerations. This is a good aspect, because it indicates that the untrusted Applet downloaded by the browser does not avoid Java security by calling ODBC. Remember that ODBC is a native code, so once you call ODBC, Java programming languages cannot guarantee that security conflicts will not occur. On the other hand, the Pure Java JDBC driver works well with Applet. They are completely downloadable and do not require any client configuration. Finally, I want to mention that the JDBC-ODBC Bridge can be used with Applet because the Applet browser assumes that the applet is trusted, so the applet will run in the Applet browser. Usually shut down Applet security is dangerous, but in some control, it may be appropriate for Applets used in the secure intranet environment. Remember If you choose this option, you will have a warning, you can avoid security issues, use a full Java (All-Java) JDBC driver.
Back to top
4. How do I start debugging with the JDBC API?
A good way to find what JDBC call is doing is to enable JDBC tracking. JDBC tracks the detailed list of activities that occurs in systems related to JDBC operations.
If you use the DriverManager Toolkit to create a database connection, use the DriverManager.SetLogWriter method to enable the JDBC operation tracking. If you use the DataSource object to get a connection, use the DataSource.setLogWriter method to enable tracking. (For centralized connections, you use the ConnectionPoolDataSource.SetLogwriter method; for the connection to the distributed transaction, use the XADataSource.setLogwriter method.)
Back to top
5. How can I use the JDBC API to access a desktop database like Microsoft Access?
Most desktop databases require JDBC solutions for ODBC. This is because suppliers of these database products have not yet implemented a full Java JDBC driver.
The best way is to use the business JDBC driver that supports the UDBC and databases you want. See the JDBC driver page for a list of available JDBC drivers.
JDBC-ODBC Bridge from Sun Java Software is not available separately to the desktop database. JDBC-ODBC Bridge loads ODBC as a local DLL and is not on the network for a typical ODBC drive for desktop databases such as Access. However, JDBC-ODBC Bridge can be used with RMI-JDBC Bridge to access databases like Access via network. This RMI-JDBC-ODBC solution is free.
Back to top
6. What are the available drivers for supporting JDBC technology?
See the web page that supports the JDBC technology driver to get the currently available driver list.
Back to top
7. What are the JDBC API documents available?
See the JDBC technology home page that some links point to information about JDBC technology. This page links to the information about features and advantages, a range of new features, the section for entry introduction, online tutorials, and a section on the driver requirements, which are also linked to the specification and javadoc documentation. Back to top
8. Is there an ODBC driver that cannot work with JDBC-ODBC Bridge?
Most ODBC 2.0 drivers should work with Bridge. Since the ODBC driver is functional, the function of Bridge may be affected. Bridge works with a popular PC database such as Microsoft Access and FoxPro.
Back to top
9. What will cause "No Suitable Driver" error?
The "NO Suitable Driver" error often occurs during the DRIVERMANAGER.GETCONNECTION method. The reason may be that the appropriate JDBC driver fails before calling the getConnection method, or it may be specifying an illegal JDBC URL - a URL that is not identified by the JDBC driver. The best way is to check the documentation of the JDBC driver or contact your JDBC driver vendor, provided that you suspect that the URL that is not specified by the JDBC driver.
Also, when you are using JDBC-ODBC Bridge, this error may happen if one or more shared libraries needed by Bridge can be loaded. If you think this is the reason, check your configuration to ensure Bridge enable access to the shared library.
Back to top
10. Why can't you find a java.sql.driverManager class?
This problem may be due to support JDK
1.0.2
Browser (such as Netscape Navigator 3.0) is running JDBC Applet. JDK 1.0.2 does not include JDBC API, so Java virtual machines running in your browser usually cannot find the DriverManager class.
Here is a solution that does not require any additional configurations on the web client. Remember, for security considerations, the classes in the Java. * Cannot be downloaded by most browsers. Therefore, many Java driver suppliers provide different versions of java.sql. * Classes, and named them jdbc.sql. *, And also provided driver versions of these modified classes. If you import jdbc.sql. * Instead of java.sql. *, Add JDBC.SQL. * Class provided by JDBC driver vendor in the basic code of the applet (CodeBase), then Applet required All JDBC classes can be downloaded by the browser at runtime, including the DriverManager class.
This solution will make Applets in support JDK
1.0.2
Any client browser works. Applets can also work in a browser that supports JDK 1.1, but for performance considerations, you may want to switch to JDK 1.1 class. Also remember that the solution depicted here is just an example, and other solutions are also possible.
Back to top
11. How do I retrieve a strong data in a time, not for each column?
The ResultSet.Getxxx method is the only way to retrieve data from the ResultSet object, indicating that a call must be issued in each column in the row. However, this is not much likely to lead to performance problems, because it is difficult to see, in any occasion, how to extract a column without at least overhead a function call. We welcome developers to provide information about this topic. Back to top
12. Why ODBC Driver Manager will return "Data Source Name NOT Found and no DEFAULT DRIVER Specified Vendor:
0 "
(Data source name is not found and there is no default driver specifies supplier: 0)?
This type of error may happen during attempts to connect to the database using Bridge. First, please note that the error is from the ODBC driver manager. This indicates that Bridge - ordinary ODBC client - has successfully called ODBC, so the problem is not caused by the locally library. In this case, it indicates that the error is due to the fact that the ODBC DSN needs to be configured on the client computer. Developers often forget this, think Bridge should find DSNs configured on remote server computers.
Back to top
13. Whether all the required JDBC drivers will create a connection to the JDK database section?
Not. In addition to JDBC-ODBC Bridge, there is no driver that supports JDBC technology to bundle with JDK 1.1.x or Java 2 Platform version. Therefore, developers need to get drivers and install it before they can connect to the database. We are considering bundling drivers that support JDBC technology in the future.
Back to top
14. Is the jdbc-odbc bridge be multi-threaded?
Not. JDBC-ODBC Bridge does not support concurrency access from different threads. JDBC-ODBC Bridge uses a synchronization method to serialize its call to ODBC. Multi-threaded Java programs can use Bridge, but they cannot get multithreaded advantages. In addition, the deadlock may occur between the lock and the signal (Semaphore) used by the database. We are considering deleting synchronization methods in the future. It turns out to add their own purpose, making things simple for the person who write Java programs that use a single-thread ODBC driver.
Back to top
15. Is the jdbc-odbc bridge support multiple concurrent open statements in each connection?
Not. When using JDBC-ODBC Bridge, each connection can only open a Statement object.
Back to top
16. When the next method works, why can't I call the ResultSet method afterlast and beforefirst?
You may be using a driver implemented for JDBC 1.0 API. It is necessary to upgrade to the JDBC 2.0 driver, which implements the scrolling result set. At the same time, it is ensured that the code has created the scrollable result set and the DBMS that is being used will support them.
Back to top
17. How can I retrieve String or other object types, don't have to create a new object each time?
Unnecessarily creates potential large number of objects (millions) and garbage collection processing, which may truly affect performance. The following method may be better: using the JDBC API, not the new object to retrieve data such as a string.
We are studying this theme, determining whether the JDBC API should be improved in some places. There may be this information in the future. Also, if you have any comments on this question, please also send us.
Back to top
18. There is a method getColumnCount in the JDBC API. Is there a similar way to find the number of rows in the result of the result? No, but the number of lines is easy. If you are using the scrollable result set RS, you can call RS.last, then call rs.getrow to find the number of rows in RS. If the result set is not rolling, you can calculate the number of rows by iteration in the result set, or submit a query, add the number of rows in the SELECT clause.
Back to top
19. I would like to download Java 2 SDK, Standard Edition JDBC-ODBC Bridge for JDBC-ODBC Bridge. I am a beginner of JDBC API, I want to start with Bridge. what should I do?
JDBC-ODBC Bridge is bundled with Java 2 SDK, Standard Edition, so there is no need to download it.
Back to top
20. If I use the JDBC API, I need to use ODBC Underneath?
There is no need, this is just one of many possible solutions. We recommend using pure drivers (type 3 or 4) that support JAVA JDBC technology to get all the advantages of the Java programming language and JDBC API.
Back to top
21. Once you have Sun's Java 2 SDK, Standard Edition, do you need to do anything else?
A driver that supports JDBC technology is still needed, and it supports the database being used. There are many drivers from various resources. You can also try to use JDBC-ODBC Bridge, provided that an ODBC database connection has been created. Bridge is provided with Java 2 SDK, Standard Edition, which does not require any additional installation. Bridge is an ordinary ODBC client. However, please note that you should use JDBC-ODBC Bridge only for test prototypes or use it when there is no other drivers available.
Back to top