您的位置:首页 > 其它

JDBC-ODBC相关的一些常见问题和解决方法zz

2006-02-05 02:19 746 查看
这篇文章列出了与JDBC-ODBC相关的一些常见问题和解决方法。其实说与JDBC-ODBC相关不太合适,因为它实际上是针对DataMorph来说的(DataMorph?我也不清楚。)。不过在上篇“java读写Excel文件”中遇到的问题([Microsoft][ ODBC Excel Driver] Operation must use an updateable query)就在这篇文章中找到了答案,所以贴出来大家分享……
I am trying to connect to a Microsoft Access 2000 database through the reader screen. I am using the JDBC-ODBC bridge driver provided. The url I am entering is 'jdbc:odbc:/c:/MyAccessData.mdb' where 'c:/MyAccessData' is the name of the Microsoft Access file. The error I keep receiving is 'Error creating connection to jdbc:odbc:/c:/MyAccessData.mdb: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified'

To use the JDBC:ODBC bridge, you first have to define an ODBC data source name (DSN) and then use that in the URL.

To create the DSN, go to Administrative Tools, start the 'Data Sources' program, depending on your operating system (2000, XP), it'll say ODBC somewhere. In USER DSN or System DSN, click on the Add... button. Choose the Microsoft Access driver out of the list, enter the DSN name, this can be any arbitrary name, and then click on the Select button to choose the Access file. In your case that would be 'c:/CampusIT.mdb'.

Now go back to DataMorph and use jdbc:odbc:DSNName for your URL, where DSNName is the name you entered when you created the ODBC data source.

[Microsoft][ODBC Excel Driver] The connection for viewing your linked Microsoft Excel worksheet was lost.This happens when you are trying to run Datamorph using an ODBC connection to an excel Spreadsheet and have the spreadsheet open at the same time. Please close the Excel Spreadsheet and Datamorph, then restart DataMorph.

[Microsoft][ ODBC Excel Driver] Operation must use an updateable query
Change the Read Only flag under Options in your ODBC data source name (DSN).

DB Exception: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer] String or binary data would be truncated.A target column is too small. The data you are trying to insert in this column is too long compared to the maximum number of characters allowed for this column. You can increase the length of this column in the database or use a formula to truncate the data (using substring function).

DB Exception: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Violation of UNIQUE KEY constraint 'CTAccount'. Cannot insert duplicate key in object 'Account'.There is a constraint violation: (In this case, there is a unique value constraint on a column)

DBException: ORA-01401: inserted value too large for column
A target column is too small. The data you are trying to insert in this column is too long compared to the maximum number of characters allowed for this column. You can increase the length of this column in the database or use a formula to truncate the data (using substring function).

DB Exception: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Syntax error converting the nvarchar value 'field content' to a column of data type int.
Data type error. For most data types, DataMorph simply sends the value to the database server and let the server do the conversion.

DB Exception: ORA-00001: unique constraint (SCOTT.CTACCOUNTCODE) violated

There is a constraint violation: (In this case, there is a unique value constraint on a column)

DB Exception: ORA-01722: invalid number
Data type error. For most data types, DataMorph simply sends the value to the database server and lets the server do the conversion.

[Microsoft][ ODBC Excel Driver] Syntax error in INSERT INTO statement.

This error occurs because a column name may be a reserved word, such as "DATE." Change the column name to a non-reserved name, such as "SaleDate". Please check the list of reserved keywords for Excel here.
Version 1.12 of DataMorph has solved this issue.

ORA-00942: table or view does not exist
Oracle ODBC expects table names to be in capital letters, you can solve this problem by changing the table name to be capitalized in the Oracle database.
Version 1.12 of DataMorph has solved this issue.

[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
This error occurs because a column name may be a reserved word, such as "DATE." Change the column name to a non-reserved name, such as "SaleDate".
Version 1.12 of DataMorph has solved this issue.

Source: http://www.qoppa.com/faq/dmfaq.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: