![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM ODBC Driver » View Thread |
Messages 1 to 4 of 4 total |
![]() |
Tue, Feb 21 2012 1:29 PM | Permanent Link |
Jim Gallagher | I have a requirement to read DBISAM tables from a Java application. I searched on Java ODBC in the forums hear and I only saw tales of failure, but that is probably the nature of the help forums. Has anyone successfully accessed DBISAM tables from Java, or even better, have an example of doing so?
Thanks, -Jim |
Mon, Mar 5 2012 12:06 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Jim,
<< I have a requirement to read DBISAM tables from a Java application. I searched on Java ODBC in the forums hear and I only saw tales of failure, but that is probably the nature of the help forums. Has anyone successfully accessed DBISAM tables from Java, or even better, have an example of doing so? >> If you're using DBISAM 4.x, then you should be able to use the JDBC/ODBC bridge driver just fine. -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Mar 5 2012 6:56 PM | Permanent Link |
Jim Gallagher | "Tim Young [Elevate Software]" wrote:
<<If you're using DBISAM 4.x, then you should be able to use the JDBC/ODBC bridge driver just fine.>> You are correct. In case someone as clueless as I am is reading this thread, here are the steps for a basic connection from Java to a DBISAM v. 4 table: 1. Install trial ODBC driver (or a licensed one - coming soon, Tim) 2. In "Control Panel|Administrative Tools|Data Sources (ODBC)" click "Add" and follow prompts to point to the data base you want. I called my Datasource "DBISAMODBC". 3. To read a table called LogTable in the above database, use this Java source (Main.java): import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; public class Main { public static void main(String[] args) throws Exception { Connection conn = getConnection(); Statement st = conn.createStatement(); st = conn.createStatement(); ResultSet rs = st.executeQuery("SELECT * FROM LogTable"); while(rs.next()){ System.out.println(rs.getString("LOGMESSAGE")); } st.close(); conn.close(); } private static Connection getConnection() throws Exception { String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; String url = "jdbc ![]() String username = ""; String password = ""; Class.forName(driver); return DriverManager.getConnection(url, username, password); } } 4. Then Javac Main.java to compile, followed by Java Main to run the test. -Jim -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Mar 5 2012 7:00 PM | Permanent Link |
Jim Gallagher | Jim Gallagher wrote:
String url = "jdbc ![]() If you're seeing a smiley face there, it is really jdbc followed by a colon, followed by odbc, followed by a colon, followed by DBISAMODBC. -Jim -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |