Home > Archive > SQL Server JDBC > January 2006 > Driver.getPropertyInfo() returns inconsistent array









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Driver.getPropertyInfo() returns inconsistent array
roger

2006-01-04, 11:23 am

Hi,

We are testingn our DbVisualizer tool with:

Microsoft SQL Server 2005 JDBC Driver - Beta 2
Version: 1.0.419.102

The problem is that Driver.getPropertyInfo() method seems to return
an array with less elements then being reported by the length attribute.
Looping over the array using its length results in a NullPointerException

if not checking that the actual value is not null.

Our tests shows that length reports 25 while there are only 17 elements
in the array.

It is easily fixed on our side but I thought you might be interested in
knowing this.

Regards

Roger Bjärevall
Minq Software
Angel Saenz-Badillos[MS]

2006-01-10, 8:23 pm

Thank you for reporting this issue. I have just tried the following code in
the latest drop of our driver and it looks like it does not have this
problem.

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Driver Driver1 = DriverManager.getDriver("jdbc:sqlserver://");
DriverPropertyInfo[] infoArray =
Driver1.getPropertyInfo("jdbc:sqlserver://", new Properties());

System.out.println(infoArray.length);
for (int i=0;i < infoArray.length ;i++){
System.out.print("NAME = "+ infoArray[i].name);
System.out.print(". VALUE = " + infoArray[i].value);
System.out.println(". DESCRIPTION = " + infoArray[i].description);
}

output:
16
NAME = user. VALUE = null. DESCRIPTION = User name
NAME = password. VALUE = null. DESCRIPTION = Password
NAME = databaseName. VALUE = null. DESCRIPTION = Database to connect to
NAME = serverName. VALUE = null. DESCRIPTION = The host to connect to
NAME = portNumber. VALUE = 1433. DESCRIPTION = The SQL Server port
NAME = sendStringParameters
AsUnicode. VALUE = true. DESCRIPTION = Send
prepared string parameters as Unicode
NAME = applicationName. VALUE = Microsoft SQL Server 2005 JDBC Driver.
DESCRIPTION = Set the application name for profiling
NAME = lastUpdateCount. VALUE = true. DESCRIPTION = Ensure that only the
last update count from an update or insert is returned
NAME = disableStatementPool
ing. VALUE = true. DESCRIPTION = Disable
statement pooling
NAME = integratedSecurity. VALUE = false. DESCRIPTION = Integrated security
NAME = lockTimeout. VALUE = -1. DESCRIPTION = Set the lock timeout
NAME = loginTimeout. VALUE = 0. DESCRIPTION = Set the login Timeout
NAME = instanceName. VALUE = null. DESCRIPTION = Set the Instance Name
NAME = xopenStates. VALUE = false. DESCRIPTION = Set the SQLException state
to XOPEN mode
NAME = selectMethod. VALUE = direct. DESCRIPTION = Enable Serverside cursors
NAME = workstationID. VALUE = null. DESCRIPTION = Host name of the
workstation
--
Angel Saenz-Badillos [MS] DataWorks
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging: http://weblogs.asp.net/angelsb/




"roger" <roger@discussions.microsoft.com> wrote in message
news:E0EBBDE9-4EFA-4AEF-AFF6- D125D51F07FA@microso
ft.com...
> Hi,
>
> We are testingn our DbVisualizer tool with:
>
> Microsoft SQL Server 2005 JDBC Driver - Beta 2
> Version: 1.0.419.102
>
> The problem is that Driver.getPropertyInfo() method seems to return
> an array with less elements then being reported by the length attribute.
> Looping over the array using its length results in a NullPointerException

> if not checking that the actual value is not null.
>
> Our tests shows that length reports 25 while there are only 17 elements
> in the array.
>
> It is easily fixed on our side but I thought you might be interested in
> knowing this.
>
> Regards
>
> Roger Bjärevall
> Minq Software



roger

2006-01-10, 8:23 pm

Angel,

Great!

I assume the "latest drop" is newer then the driver we've tried with?

Regards

Roger

"Angel Saenz-Badillos[MS]" wrote:

> Thank you for reporting this issue. I have just tried the following code in
> the latest drop of our driver and it looks like it does not have this
> problem.
>
> Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
> Driver Driver1 = DriverManager.getDriver("jdbc:sqlserver://");
> DriverPropertyInfo[] infoArray =
> Driver1.getPropertyInfo("jdbc:sqlserver://", new Properties());
>
> System.out.println(infoArray.length);
> for (int i=0;i < infoArray.length ;i++){
> System.out.print("NAME = "+ infoArray[i].name);
> System.out.print(". VALUE = " + infoArray[i].value);
> System.out.println(". DESCRIPTION = " + infoArray[i].description);
> }
>
> output:
> 16
> NAME = user. VALUE = null. DESCRIPTION = User name
> NAME = password. VALUE = null. DESCRIPTION = Password
> NAME = databaseName. VALUE = null. DESCRIPTION = Database to connect to
> NAME = serverName. VALUE = null. DESCRIPTION = The host to connect to
> NAME = portNumber. VALUE = 1433. DESCRIPTION = The SQL Server port
> NAME = sendStringParameters
AsUnicode. VALUE = true. DESCRIPTION = Send
> prepared string parameters as Unicode
> NAME = applicationName. VALUE = Microsoft SQL Server 2005 JDBC Driver.
> DESCRIPTION = Set the application name for profiling
> NAME = lastUpdateCount. VALUE = true. DESCRIPTION = Ensure that only the
> last update count from an update or insert is returned
> NAME = disableStatementPool
ing. VALUE = true. DESCRIPTION = Disable
> statement pooling
> NAME = integratedSecurity. VALUE = false. DESCRIPTION = Integrated security
> NAME = lockTimeout. VALUE = -1. DESCRIPTION = Set the lock timeout
> NAME = loginTimeout. VALUE = 0. DESCRIPTION = Set the login Timeout
> NAME = instanceName. VALUE = null. DESCRIPTION = Set the Instance Name
> NAME = xopenStates. VALUE = false. DESCRIPTION = Set the SQLException state
> to XOPEN mode
> NAME = selectMethod. VALUE = direct. DESCRIPTION = Enable Serverside cursors
> NAME = workstationID. VALUE = null. DESCRIPTION = Host name of the
> workstation
> --
> Angel Saenz-Badillos [MS] DataWorks
> This posting is provided "AS IS", with no warranties, and confers no
> rights.Please do not send email directly to this alias.
> This alias is for newsgroup purposes only.
> I am now blogging: http://weblogs.asp.net/angelsb/
>
>
>
>
> "roger" <roger@discussions.microsoft.com> wrote in message
> news:E0EBBDE9-4EFA-4AEF-AFF6- D125D51F07FA@microso
ft.com...
>
>
>

Angel Saenz-Badillos[MS]

2006-01-10, 8:23 pm

Yes, I am sorry I am actually talking about the latest internal drop. The
driver is slated to ship this month but if you feel that there may still be
a bug here (If the code that I provided is not what you are using) I would
be happy to work with you to get this resolved.

--
Angel Saenz-Badillos [MS] DataWorks
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging: http://weblogs.asp.net/angelsb/




"roger" <roger@discussions.microsoft.com> wrote in message
news:C3335085-598D-4CC4-BEC6- F14D3156AD39@microso
ft.com...[color=darkred]
> Angel,
>
> Great!
>
> I assume the "latest drop" is newer then the driver we've tried with?
>
> Regards
>
> Roger
>
> "Angel Saenz-Badillos[MS]" wrote:
>


roger

2006-01-10, 8:23 pm

Ok.

The code you have tested with is the exact same as we have but we get nulls
after a while. It appears it has been fixed in the latest drop you are using
so I am perfectlyl fine with that. Thanks!

Roger

"Angel Saenz-Badillos[MS]" wrote:

> Yes, I am sorry I am actually talking about the latest internal drop. The
> driver is slated to ship this month but if you feel that there may still be
> a bug here (If the code that I provided is not what you are using) I would
> be happy to work with you to get this resolved.
>
> --
> Angel Saenz-Badillos [MS] DataWorks
> This posting is provided "AS IS", with no warranties, and confers no
> rights.Please do not send email directly to this alias.
> This alias is for newsgroup purposes only.
> I am now blogging: http://weblogs.asp.net/angelsb/
>
>
>
>
> "roger" <roger@discussions.microsoft.com> wrote in message
> news:C3335085-598D-4CC4-BEC6- F14D3156AD39@microso
ft.com...
>
>
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com