Connecting ODBC Sources in Run time

HiI have assigned a project in which user has to give database file/text file or any other ODBC source like (Access, Excel, SQL Server or Oracle) in RUN TIME. Can any one have any idea? Regards
[214 byte] By [shahbaaz_alia] at [2007-10-3 4:33:34]
# 1

> Hi

> I have assigned a project in which user has to give

> database file/text file or any other ODBC source like

> (Access, Excel, SQL Server or Oracle) in RUN TIME.

> Can any one have any idea?

I don't have an idea what you are talking about. If you mean, you want to use the JDBC-ODBC bridge driver without having a DSN, refer to: http://www.rgagnon.com/javadetails/java-0345.html

aniseeda at 2007-7-14 22:37:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
@ aniseed yes you guessed right.. i have to connet using JDBC-ODBC bridge..I have seen the link but it contains only for Access and Excel , can I connect SQL SERVER like access or Excel in run time using JDBC-ODBC bridge driver?
shahbaaz_alia at 2007-7-14 22:37:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Of course. All you have to do to find out how is, set up a DSN for SQL Server. Then look at it, compare it to a DSN for e.g. Excel, and change whatever is different.
DrClapa at 2007-7-14 22:37:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

connection = DriverManager.getConnection("jdbc:odbc:Driver={SQL Server};Server=Server Name;Database=database name" ,"user","passwd");

Try this I got same problem but on Forum I got answer Without creating DSN U can create connection by this line just change

Driver={SQL Server}

For SQL Server itsd running properly check out for others ie Access , Excel

dinesh_bartakkea at 2007-7-14 22:37:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5

> connection =

> DriverManager.getConnection("jdbc:odbc:Driver={SQL

> Server};Server=Server Name;Database=database name"

> ,"user","passwd");

>

>

> Try this I got same problem but on Forum I got answer

> Without creating DSN U can create connection by this

> line just change

>Driver={SQL Server}

> SQL Server itsd running properly check out for

> others ie Access , Excel

That isn't sufficient.

The syntax for each source is different.

jschella at 2007-7-14 22:37:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 6
connection = DriverManager.getConnection("jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=d:/data/data.mdb","username", "password"); For Access u can try this.
dinesh_bartakkea at 2007-7-14 22:37:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 7
Get different Driver names from data source. I got Access Driver name from data source.
dinesh_bartakkea at 2007-7-14 22:37:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 8

> connection =

> DriverManager.getConnection("jdbc:odbc:DRIVER=Microsof

> t Access Driver

> (*.mdb);DBQ=d:/data/data.mdb","username",

> "password");

>

>

> For Access u can try this.

You originally posted for SQL server, vaguely mentioning that this works the same way for all others and jschell already pointed out that it isn't sufficient... rightly so. As for what you are mentioning here, it is mentioned in the link posted in reply 1.

aniseeda at 2007-7-14 22:37:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 9
> Get different Driver names from data source. I got> Access Driver name from data source.Most of them have already done that.
aniseeda at 2007-7-14 22:37:11 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...