Not sure why SQLServer is being grumpy and Access works - it's usually the
other way around :)

The only thing that I can think of is that SQLServer is only allowing you
one active statement per connection when working with metadata. Here's what
happens (working from memory here; it's been a long time since I wrote the
Bridge): when you call getTables(), a new statement handle is created, the
ODBC SQLTables function invoked (which causes the underlying ODBC driver to
issue a database query), and the result set is returned. Calling
getColumns() works in a similar way, calling SQLColumns. Maybe SQLServer is
doing some special statement processing/caching when using metadata that
precludes you from having multiple active statements - I just don't know
what the ODBC driver is doing under the covers.

The generic way to program for this case is to build an
array/Vector/Collection of the table names up front, and then process the
column names for each table in a separate loop.

Hope this helps,

Karl.

-----Original Message-----
From: JustinMacCarthy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 04, 2001 9:45 AM
To: JRun-Talk
Subject: RE: JDBC Drivers +


Sure : Pretty much like the following (I don't have the actual code in front
of me ):


        DatabaseMetaData metadata = connection.getMetaData()

        String[] tableTypes = { "TABLE"};                   // We want only
tables
        ResultSet tables = metadata.getTables(              // Get the
tables info
                                          null,
                                          null,
                                          null,
                                          tableTypes);

        String tableName;                           // Stores a table name


      while(tables.next())                              // For each table
      {
      tableName = tables.getString("TABLE_NAME");     // get the table name
        System.out.println(tableName);

        //MARKER
      // Get all the columns for the current table
        ResultSet columnNames = metadata.getColumns(null, null, tableName,
null);

        // inner loop
      while(columnNames.next())
                System.out.println("\t" +
columnNames.getString("COLUMN_NAME"));

        //MARKER_END

      }



Using MDAC 2.5 + sun.jdbc.odbc.JdbcOdbcDriver on Win2000, sun SDK 1.3 works
fine with AccessdataSource
Error with SqlServer

If I put the section between //MARKER & //MARKER_END outside the
tables.next() loop , using a tablename it works fine.
Really a Java issue and not really a JRun issues though :-)

Thanks

Justin


>-----Original Message-----
>From: Karl Moss [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, January 04, 2001 1:41 PM
>To: JRun-Talk
>Subject: RE: JDBC Drivers
>
>
>Can you post the offending code?
>
>Karl Moss
>Allaire Corp.
>
>-----Original Message-----
>From: JustinMacCarthy [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, January 04, 2001 8:36 AM
>To: JRun-Talk
>Subject: RE: JDBC Drivers
>
>
>Do these drivers support the DatabaseMetaData stuff???
>
>On a related note can anyone tell me how the DatabaseMetaData methods
>...getTables and .getColumns return ResultSets ?
>
>I have some code that works with the Access Odbc driver , but not the SQL
>Server driver  via the Odbc-bridge
>
>The code in question uses DatabaseMetaData.getTables
>to return the DB tables and loops over the ResultSet returned and retrieves
>the Columns of each table using DatabaseMetaData.getColumns() and an inner
>loop loops over the column name.
>
>However I get an ODBC error, "Database busy waiting for another hinst"
>(something like that, haven't got the exact test here)
>
>I thought that because the DatabaseMetaData.getTables()
>method had executed that the connection would be free (not using pooling).
>
>It works if I put the getColumns method outside the getTable loop.
>
>Any ideas?
>
>Thanks Justin
>
>
>>-----Original Message-----
>>From: Scott M. Stirling [mailto:[EMAIL PROTECTED]]
>>Sent: Thursday, January 04, 2001 6:18 AM
>>To: JRun-Talk
>>Subject: Re: JDBC Drivers
>>
>>
>>On 26 Dec 2000 11:45:22 -0500, Bob Smith wrote:
>>> Hi,
>>>  I am new to JRUN. We are required to integrate with SQL
>>Server7.0. We also
>>> develop applications with ColdFusion. I was wondering if
>>JRUN/Allaire has some
>>> recommendations for JDBC drivers or perhaps JRUN has its own
>>JDBC drivers and
>>> I have missed it.
>>>
>>>
>>> Thanks,
>>> Bob
>>
>>
>>Funny you should ask, Bob.  We'll be shipping Merant Type IV JDBC
>>drivers with a new JRun Advanced Edition very soon.  Meanwhile, for
>>development you can use the Weblogic JDBC driver for SQLServer (see
>>www.bea.com) or try www.inetsoftware.de -- they have very popular, tried
>>and true JDBC drivers for SQLServer.
>>
>>--
>>Scott Stirling
>>West Newton, MA
>>
>>
>>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to