database-metadata

jTDS incorrectly reports data type info in result set metadata (for DATE columns, reports NVARCHAR)

橙三吉。 提交于 2019-12-20 03:48:09
问题 Currently, the jTDS JDBC driver (1.2.5) against Microsoft SQL Server 2008 appears to incorrectly report the data type for DATE columns as NVARCHAR. It probably behaves the same for both earlier versions of jTDS and SQL Server (2005, 2000) Are there any workarounds for this that don't require switching to a different driver (for example Microsoft's own driver) or patching the jTDS driver? Also I would like to avoid having to perform queries against the data dictionary (INFORMATION_SCHEMA

How to get all table names from a database?

回眸只為那壹抹淺笑 提交于 2019-12-17 03:31:12
问题 I'd like to retrieve all table names from a database schema, and, if possible, get all table starting with a specified prefix. I tried using JDBC's connection.getMetaData().getTables() but it didn't work at all. Connection jdbcConnection = DriverManager.getConnection("", "", ""); DatabaseMetaData m = jdbcConnection.getMetaData(); ResultSet tables = m.getTables(jdbcConnection.getCatalog(), null, "TAB_%", null); for (int i = 0; i < tables.getMetaData().getColumnCount(); i++) { System.out

Why I cannot debug a DatabaseMetaData?

随声附和 提交于 2019-12-12 19:02:47
问题 I've a strange situation with a little application in Java using a JDBC-OBDC. I'm inspecting a Database using the DatabaseMetaData Class. When I execute the program, everything works without anyproblem. But when I want to debug to see the values inside the Resulset containing the DatabaseMetaData a java.sql.SQLException is thrown only if I put a breakpoint within the while. Here's my code: DatabaseMetaData patrol = con.getMetaData(); ResultSet answer = patrol.getTables(null, null, null, null)

Table-valued function refresh

你离开我真会死。 提交于 2019-12-10 14:36:54
问题 I have a table-valued function (TVF) in SQL Server that looks like this: CREATE FUNCTION TVF_xyz(@AuditKey INT) RETURNS TABLE AS RETURN SELECT * FROM xyz WHERE AUDIT_KEY = @AuditKey GO Now, I added a new column to the xyz table. When I query using TVF_xyz , it doesn't show me the new column (shows all other columns except newly added). Query: SELECT TOP 10 * FROM TVF_xyz (1543) I would like to know, how to refresh TVF to show new column. PS: Select * used in TVF to fetch all columns. 回答1:

Is there a quick way to report database metadata in SQL Server 2005?

孤者浪人 提交于 2019-12-10 11:12:52
问题 Are there any system stored procs to report the stats and metadata of a database itself in SQL Server 2005? What I need is a quick way to output a list of tables, the size of each table, the number of rows in each table and so on. Stored procs for individual tables and metadata would also be useful. Advice appreciated. 回答1: Yes, the data dictionary tables will let you do this. The main tables in the data dictionary are sys.objects, sys.columns, sys.indexes, sys.foreign_keys and sys.sql

exporting db objects for version control

久未见 提交于 2019-12-08 03:40:09
问题 We are implementing version control for our project. As part of this we need to check in all DB objects. We have tables, procedures, functions, packages, view and materialized view. Problem is there are many objects and we need to put source code file wise. e.g. There are tables T1, T2, T3 and we need files Table_T1.txt which will have T1 definition ( columns definition, indexes for the table and grants) and so on for all objects. I m aware of metadata tables such as DBA_VIEWS , dba_source

Retrieve mysql table comment using DatabaseMetaData

浪子不回头ぞ 提交于 2019-12-07 22:03:45
问题 So I'm using Vaadin Java web framework for a project which requires the ability to edit the table. Vaadin provides a way to get Connection object from SimpleJDBCConnectionPool (Here's the API) From the Connection I can get DatabaseMetaData object. And I have the following code: private List<String> getTableNames(DatabaseMetaData md) throws SQLException { ArrayList<String> tables = new ArrayList<String>(); ResultSet rs = md.getTables(null, null, "", null); while (rs.next()) { tables.add(rs

How to retrieve sequences metadata from JDBC?

坚强是说给别人听的谎言 提交于 2019-12-07 06:24:28
问题 I am trying to retrieve different kind of metadata of my Oracle DB from Java code (using basic JDBC). For example, if I want to retrieve the list of tables with _FOO suffix, I can do something like: Connection connection = dataSource.getConnection(); DatabaseMetaData meta = connection.getMetaData(); ResultSet tables = meta.getTables(connection.getCatalog(), null, "%_FOO", new String[] { "TABLE" }); // Iterate on the ResultSet to get information on tables... Now, I want to retrieve all the

exporting db objects for version control

为君一笑 提交于 2019-12-06 16:22:13
We are implementing version control for our project. As part of this we need to check in all DB objects. We have tables, procedures, functions, packages, view and materialized view. Problem is there are many objects and we need to put source code file wise. e.g. There are tables T1, T2, T3 and we need files Table_T1.txt which will have T1 definition ( columns definition, indexes for the table and grants) and so on for all objects. I m aware of metadata tables such as DBA_VIEWS , dba_source and DBMS_METADATA.GET_DDL etc where I can find required information but how to pull that information

Is there a quick way to report database metadata in SQL Server 2005?

旧巷老猫 提交于 2019-12-06 05:27:51
Are there any system stored procs to report the stats and metadata of a database itself in SQL Server 2005? What I need is a quick way to output a list of tables, the size of each table, the number of rows in each table and so on. Stored procs for individual tables and metadata would also be useful. Advice appreciated. ConcernedOfTunbridgeWells Yes, the data dictionary tables will let you do this. The main tables in the data dictionary are sys.objects , sys.columns , sys.indexes , sys.foreign_keys and sys.sql_modules . For an example of a variety of queries that use the system data dictionary