Connecting SQL server in runtime..

I have to connect to SQL database file (*.mdf / *.mdl) in RUNTIME...How can i do this? what will be its connection string..
[130 byte] By [shahbaaz_alia] at [2007-11-26 21:33:55]
# 1

Hi, your first should be what is the Driver class for the connection.

My first question is: What is an SQL database file ?

SQL stands for Structured Query Language. So basically I am not expecting a file but rather some sort of server that can handle the SQL commands....

So look for the SQL product you have (MySQL, SQL-Server, ORACLE, DB2 etc...). And try to find some information (best on the respective homepage) regarding how to set up the environment for jdbc, which driver class to use and how to establish a connection.

g_magossa at 2007-7-10 3:15:06 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Actually i want to connect to SQL Server database ..

I am developing a ETL (Extract, Transform and load) tool in which source and target database is given by the user at runtime.. What connection string should be used to established connection with SQL server (*.mdf ) file is it possible?

shahbaaz_alia at 2007-7-10 3:15:06 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

You don't use 'files' when connecting to SQL Server.The use of files generally only applies to very simple databases like MS Access.

Presumably you are just experimenting. So you can google for a connection string using the odbc-bridge for SQL Server. If you want a user to type something in then they can type in the database name, user name and password.

jschella at 2007-7-10 3:15:06 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...