Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using Driver Manager without fully qualified table names  RSS feed

 
Liz Clarey
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the java.sql.DriverManager class to access an SQLServer database. (Yes I know it's not the preferred way any more, but it's legacy code and I can't change that part of it).

Is there any way to use the Properties passed into getConnection() to specify the database name?

I know that you can use the fully qualified table names, but I was wondering if there were any other options.

Liz
 
Rashid Ali
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What i understand from your querry is that you wanna to pass Properties object to getConnection()'s constructor.
There are three constructors of getConnection() method which are:
getConnection( String url )
getConnection( String url , java.util.Properties info )
getConnection( String url , String user , String password )
that means the 2nd constructor allows you to pass on the Properties' obj in the getConnection() method.
Hope it suffices your querry.
Good luck
Rashid Ali
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!