Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cannot connect to MSSQL databases with a dash "-" in the name

7 views
Skip to first unread message

Scott

unread,
Mar 9, 2004, 3:38:02 PM3/9/04
to

If i try and connect to a database named, dash-database, for example, the JDBC
driver will complain that "dash" is an unknown database. Somehow the driver is
truncating the name. I tried it in the URL and in the Connection.setCatalog()
call and they both fail. I'm using version 12 of the driver.

Thanks, Scott

Joe Weinstein

unread,
Mar 9, 2004, 4:00:03 PM3/9/04
to Scott

Scott wrote:

Show me the URL and properties you are using.
thanks,
Joe

>
> Thanks, Scott

scott

unread,
Mar 10, 2004, 1:09:57 PM3/10/04
to

The URL is: jdbc:weblogic:mssqlserver4:dash-database@sfrolichxp:1433
The properties contains the "user" and "password" keys and values
I'm making the call: thisConnection = DriverManager.getConnection(URLConn, props);
// this is where it fails

Thanks, Scott

Joe Weinstein

unread,
Mar 10, 2004, 1:40:21 PM3/10/04
to scott

scott wrote:

> The URL is: jdbc:weblogic:mssqlserver4:dash-database@sfrolichxp:1433
> The properties contains the "user" and "password" keys and values
> I'm making the call: thisConnection = DriverManager.getConnection(URLConn, props);
> // this is where it fails
>
> Thanks, Scott

Sure. Ok, try this:
"jdbc:weblogic:mssqlserver4:sfrolichxp:1433"
and add the property "db" to the props, with a value of the database context you want.
If that doesn't work, could you just connect to the default database context and
show me what the query "select * from master..sysdatabases" returns? You can do that
osql etc...
thanks
Joe

Joe Weinstein

unread,
Mar 10, 2004, 4:26:22 PM3/10/04
to Scott
Scott wrote:

> Joe Weinstein <joeN...@bea.com> wrote:
>
>>
>>scott wrote:
>>>The URL is: jdbc:weblogic:mssqlserver4:dash-database@sfrolichxp:1433
>>>The properties contains the "user" and "password" keys and values
>>>I'm making the call: thisConnection = DriverManager.getConnection(URLConn,
>>props);
>>

>>Sure. Ok, try this:
>>"jdbc:weblogic:mssqlserver4:sfrolichxp:1433"
>>and add the property "db" to the props, with a value of the database
>>context you want.
>>If that doesn't work, could you just connect to the default database
>>context and
>>show me what the query "select * from master..sysdatabases" returns?
>>You can do that
>>osql etc...
>>thanks

>>>Joe Weinstein <joeN...@bea.com> wrote:


>>>
>>>>Scot wrote:
>>>>
>>>>>If i try and connect to a database named, dash-database, for example,
>>>>the JDBC
>>>>>driver will complain that "dash" is an unknown database. Somehow the
>>>>driver is
>>>>>truncating the name. I tried it in the URL and in the Connection.setCatalog()
>>>>>call and they both fail. I'm using version 12 of the driver.
>>>>
>>>>Show me the URL and properties you are using.
>>>>thanks,
>>>>Joe
>

> Sorry but the connection still fails with the same message. Attached is the results
> from the "select *..." query

Odd! Now if you get the connection without specifying the db property,
and call Connection.setCatalog("dash-database"); can you show me the
whole stacktrace of the exception? What version of the Weblogic server
are you using?
thanks
Joe

>
> ------------------------------------------------------------------------
>
> bigrepository 9 0x01050000000000051500000043256A065C1E782C6D796D60E4050000 0 16 1090519040 2003-12-16 10:26:49.623 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\bigrepository_Data.MDF 539
> dash-database 11 0x01050000000000051500000043256A065C1E782C6D796D60E4050000 0 16 1090519040 2004-03-09 12:09:14.760 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\dash-database_Data.MDF 539
> football 10 0x01050000000000051500000043256A065C1E782C6D796D60E4050000 0 16 1090519040 2004-01-05 16:12:20.150 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\football_Data.MDF 539
> master 1 0x01 0 24 1090519040 2000-08-06 01:29:12.250 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\master.mdf 539
> model 3 0x01 0 1073741840 1090519040 2000-08-06 01:40:52.437 2000-08-06 01:40:52.437 0 80 C:\Databases\MSSQL\data\model.mdf 539
> msdb 4 0x01 0 24 1090520064 2000-08-06 01:40:56.810 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\msdbdata.mdf 539
> Northwind 6 0x01 0 28 1090519040 2000-08-06 01:41:00.310 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\northwnd.mdf 539
> pubs 5 0x01 0 24 1090519040 2000-08-06 01:40:58.560 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\pubs.mdf 539
> repository 7 0x010500000000000515000000A1F40462093A2A24828BA628EB030000 0 16 1090519040 2003-10-17 07:51:03.030 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\repository_Data.MDF 539
> tempdb 2 0x01 0 8 1090519040 2004-03-08 13:43:53.377 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\tempdb.mdf 539
> weblogic 8 0x01050000000000051500000043256A065C1E782C6D796D60E4050000 0 16 1090519040 2003-11-20 16:43:37.157 1900-01-01 00:00:00.000 0 80 C:\Databases\MSSQL\data\weblogic_Data.MDF 539
>

Scott

unread,
Mar 11, 2004, 11:20:04 AM3/11/04
to
Here's the stack trace:

java.sql.SQLException: Could not locate entry in sysdatabases for database 'dash'.
No entry found with that name. Make sure that the name is entered correctly. Severity
16, State 1, Procedure 'SFROLICHXP null', Line 1
at weblogic.jdbcbase.mssqlserver4.TdsStatement.processWarning(TdsStatement.java:1240)
at weblogic.jdbcbase.mssqlserver4.TdsStatement.parseMsWarning(TdsStatement.java:1151)
at weblogic.jdbcbase.mssqlserver4.TdsStatement.getMoreResults(TdsStatement.java:814)
at weblogic.jdbcbase.mssqlserver4.TdsStatement.execute(TdsStatement.java:211)
at weblogic.jdbcbase.mssqlserver4.BaseConnection.setCatalog(BaseConnection.java:779)
at weblogic.jdbcbase.mssqlserver4.BaseConnection.setCatalog(BaseConnection.java:756)
at weblogic.jdbcbase.mssqlserver4.TdsConnection.login(TdsConnection.java:87)
at weblogic.jdbc.mssqlserver4.MicrosoftConnection.login(MicrosoftConnection.java:54)
at weblogic.jdbcbase.mssqlserver4.BaseConnection.prepareConnection(BaseConnection.java:186)
at weblogic.jdbc.mssqlserver4.Driver.newConnection(Driver.java:32)
at weblogic.jdbcbase.mssqlserver4.ConnectDriver.connect(ConnectDriver.java:148)
at java.sql.DriverManager.getConnection(DriverManager.java:523)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at com.alphablox.jndisp.DBContextImp.createConnection(DBContextImp.java:287)

Joe Weinstein

unread,
Mar 11, 2004, 11:54:42 AM3/11/04
to Scott

Hi. That exception indicate that the properties or URL are still
indicating the database you want. What I want you to do is to
remove any reference to 'dash-database' in the URL and properties.
Just get a connection to the user's default database. Then call
conn.setCatalog("dash-database");
Tell me if that works.
Joe

Scott

unread,
Mar 15, 2004, 1:59:26 PM3/15/04
to

Hi,
Here is the new stack trace

Thanks, Scott

java.sql.SQLException: Could not locate entry in sysdatabases for database 'dash'.
No entry found with that name. Make sure that the name is entered correctly. Severity
16, State 1, Procedure 'SFROLICHXP null', Line 1
at weblogic.jdbcbase.mssqlserver4.TdsStatement.processWarning(TdsStatement.java:1240)
at weblogic.jdbcbase.mssqlserver4.TdsStatement.parseMsWarning(TdsStatement.java:1151)
at weblogic.jdbcbase.mssqlserver4.TdsStatement.getMoreResults(TdsStatement.java:814)
at weblogic.jdbcbase.mssqlserver4.TdsStatement.execute(TdsStatement.java:211)
at weblogic.jdbcbase.mssqlserver4.BaseConnection.setCatalog(BaseConnection.java:779)
at weblogic.jdbcbase.mssqlserver4.BaseConnection.setCatalog(BaseConnection.java:756)

at com.alphablox.jndisp.DBContextImp.createConnection(DBContextImp.java:288)

Joe Weinstein

unread,
Mar 15, 2004, 4:10:31 PM3/15/04
to Scott

Scott wrote:

> Hi,
> Here is the new stack trace
>
> Thanks, Scott
>
> java.sql.SQLException: Could not locate entry in sysdatabases for database 'dash'.
> No entry found with that name. Make sure that the name is entered correctly. Severity
> 16, State 1, Procedure 'SFROLICHXP null', Line 1
> at weblogic.jdbcbase.mssqlserver4.TdsStatement.processWarning(TdsStatement.java:1240)
> at weblogic.jdbcbase.mssqlserver4.TdsStatement.parseMsWarning(TdsStatement.java:1151)
> at weblogic.jdbcbase.mssqlserver4.TdsStatement.getMoreResults(TdsStatement.java:814)
> at weblogic.jdbcbase.mssqlserver4.TdsStatement.execute(TdsStatement.java:211)
> at weblogic.jdbcbase.mssqlserver4.BaseConnection.setCatalog(BaseConnection.java:779)
> at weblogic.jdbcbase.mssqlserver4.BaseConnection.setCatalog(BaseConnection.java:756)
> at com.alphablox.jndisp.DBContextImp.createConnection(DBContextImp.java:288)
>

Yow. Our driver just sends raw fresh SQL "use " + <database_name> for that call. Could this be
a DBMS problem? One more test: Just get the connection like above, but instead of calling setCatalog(),
just do this:

Statement s = c.createStatement();
s.executeUpdate("use dash-database");

If that fails, it's a DBMS SQL parser bug.
Joe

Scott

unread,
Mar 15, 2004, 4:27:55 PM3/15/04
to

Hi,
I tried "use dash-database" in MSSQL's Query Analyzer tool and it fails there
with the same message! Guess it isn't WebLogic's fault.

Thanks for all the hard work Joe!

Scott

Joe Weinstein

unread,
Mar 15, 2004, 4:35:06 PM3/15/04
to Scott

Scott wrote:

> Hi,
> I tried "use dash-database" in MSSQL's Query Analyzer tool and it fails there
> with the same message! Guess it isn't WebLogic's fault.

Q.E.D!

0 new messages