jdbc-odbc

JDBC-ODBC Bridge Removed in Java 8, what is the best alternative? [duplicate]

半城伤御伤魂 提交于 2019-12-02 01:09:51
This question already has an answer here: Manipulating an Access database from Java without ODBC 1 answer Seeing as Oracle has removed the JDBC-ODBC Bridge driver in the latest release of Java (version 8), is there a good alternative that will enable us developers to access ODBC databases in Java 8? Oracle is apparently recommending that we use vendor-specific JDBC drivers instead of the Bridge, which tells me that Microsoft should have its own JDBC driver for connecting to MS Access databases in Java. http://docs.oracle.com/javase/7/docs/technotes/guides/jdbc/bridge.html I'm currently looking

Java Access DB Connection

筅森魡賤 提交于 2019-12-01 06:05:43
I try to make project with connection to db (MS Access 2010) I use this tutorial on CodeProject . import java.sql.*; public class DbAccess { public static void main(String[] args) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=myDB.mdb;"; Connection conn = DriverManager.getConnection(database, "", ""); Statement s = conn.createStatement(); // create a table String tableName = "myTable" + String.valueOf((int)(Math.random() * 1000.0)); String createTable = "CREATE TABLE " + tableName + " (id Integer, name Text(32))

Java Access DB Connection

▼魔方 西西 提交于 2019-12-01 03:23:22
问题 I try to make project with connection to db (MS Access 2010) I use this tutorial on CodeProject. import java.sql.*; public class DbAccess { public static void main(String[] args) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=myDB.mdb;"; Connection conn = DriverManager.getConnection(database, "", ""); Statement s = conn.createStatement(); // create a table String tableName = "myTable" + String.valueOf((int)(Math

How to specify null value in MS Access through the JDBC-ODBC bridge?

人盡茶涼 提交于 2019-11-30 22:49:04
I am not able to call setNull on PreparedStatement using MS Access (sun.jdbc.odbc.JdbcOdbcDriver) preparedStatement.setNull(index, sqltype). Is there a workaround for this? For LONGBINARY data type, I tried the following calls, neither worked. setNull(index, java.sql.Types.VARBINARY) setNull(index, java.sql.Types.BINARY) java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Invalid SQL data type at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114) at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterNull(JdbcOdbc.java:986

How to specify null value in MS Access through the JDBC-ODBC bridge?

别说谁变了你拦得住时间么 提交于 2019-11-30 17:27:52
问题 I am not able to call setNull on PreparedStatement using MS Access (sun.jdbc.odbc.JdbcOdbcDriver) preparedStatement.setNull(index, sqltype). Is there a workaround for this? For LONGBINARY data type, I tried the following calls, neither worked. setNull(index, java.sql.Types.VARBINARY) setNull(index, java.sql.Types.BINARY) java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Invalid SQL data type at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957) at sun.jdbc.odbc

Java program to connect to Sql Server and running the sample query From Eclipse

冷暖自知 提交于 2019-11-30 09:37:41
package sqlselection; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class Sqlselection { public static void main(String[] args) { try { Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); String userName = "sa"; String password = "password"; String url = "jdbc:microsoft:sqlserver://localhost:1433"+";databaseName=AdventureWorks2008R2"; Connection con = DriverManager.getConnection(url, userName, password); Statement s1 = con.createStatement(); ResultSet rs = s1.executeQuery("SELECT TOP 1 * FROM HumanResources

sun.jdbc.odbc.JdbcOdbcDriver not working with jdk 1.8

旧城冷巷雨未停 提交于 2019-11-29 18:00:22
I downloaded jdk8u40 and now I get: SQLException: SQLState: 08001 Message: No suitable driver found for jdbc:odbc:mysqlDB Vendor: 0 where mysqlDB is my data source name. I use: jdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver jdbc.url=jdbc:odbc:mysqlDB as connection strings. I have downloaded and installed driver: mysql-connector-odbc-5.3.4-winx64.msi I read in your forums that the jdbc-odbc bridge is no longer supported in jdk 1.8. Any help appreciated. KylePorter The JDBC-ODBC bridge is no longer shipped/supported with JDK 8 , hence the errors: The JDBC-ODBC Bridge should be considered a

Java program to connect to Sql Server and running the sample query From Eclipse

淺唱寂寞╮ 提交于 2019-11-29 14:16:26
问题 package sqlselection; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class Sqlselection { public static void main(String[] args) { try { Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); String userName = "sa"; String password = "password"; String url = "jdbc:microsoft:sqlserver://localhost:1433"+";databaseName=AdventureWorks2008R2"; Connection con = DriverManager.getConnection(url, userName, password);

oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection

别等时光非礼了梦想. 提交于 2019-11-29 08:01:00
WrappedConnectionJDK6 wrapped = (WrappedConnectionJDK6) dbStrategy.getConnection(); Connection underlyingConn = wrapped.getUnderlyingConnection(); OracleConnection oracleConn = (OracleConnection)underlyingConn; Last line gives Error - > ERROR > [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/web].[resteasy-servlet]] > (http-/0.0.0.0:8080-1) Servlet.service() for servlet resteasy-servlet > threw exception: org.jboss.resteasy.spi.UnhandledException: > java.lang.ClassCastException: oracle.jdbc.driver.T4CConnection cannot > be cast to oracle.jdbc.OracleConnection AFAIK

Java ODBC MS-Access Unicode character problems

拥有回忆 提交于 2019-11-28 13:01:58
I am trying to make an application that connects to an Access database. I have made it through making the ODBC connection of my Java program with an .mdb file but I have this problem with Unicode characters. If a record is written in English (Latin) characters then the .mdb file recognizes the characters but if the record is written in Greek then some weird characters appear and I can't get the record with the ResultSet object. Can someone help? Gord Thompson The JDBC-ODBC Bridge will not work correctly with the Access ODBC driver when strings contain Unicode characters whose code point is