Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / April 2006

Tip: Looking for answers? Try searching our database.

MSAccess get Query SQL source possible

Thread view: 
Jochen Riekhof - 24 Apr 2006 16:48 GMT
Hi...

for diagnostic purpose I would like to get the Query SQL source code out
of MSAccess, preferrably using special SQL (e.g. with SQLServer you can
do exec sp_helptext "'MySP'") or COM if necessary. Is there any way to
accomplish this?

Thanks for any hint!

Ciao

...Jochen
DM McGowan II - 25 Apr 2006 05:41 GMT
> Hi...
>
[quoted text clipped - 8 lines]
>
> ...Jochen

In access, open the query in design view the go to the view menu and select
sql view.

You can also set up an odbc data source and go to control panel, admin
tools, odbc admin and set up tracing.
Bjorn Abelli - 26 Apr 2006 04:03 GMT
> for diagnostic purpose I would like to get the Query
> SQL source code out of MSAccess, preferrably using
[quoted text clipped - 3 lines]
>
> Thanks for any hint!

You asked for it. ;-)

As you requested *any* hint, I suggest you look into how to access the
system table "MSysQueries", and possibly some other as well, as the
"MSysQueries" mostly isn't built up as scripts like stored procedures, but
with relations defined by the query editor...

Hint, hint...

Now, the tricky part should be how to access that system table from Java...

I believe I saw some hack in C++ a couple of years ago that could accomplish
this by some low level access to some native API, don't ask me where I saw
it...

// Bjorn A
hilz - 27 Apr 2006 00:19 GMT
>> for diagnostic purpose I would like to get the Query
>> SQL source code out of MSAccess, preferrably using
[quoted text clipped - 22 lines]
>
> Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php

I don't believe you need a low level access to some native API to see
those system tables because if you connect to MS Access using the
myeclipse db explorer (odbc dns-less connection) you can see the system
tables there. so i guess it is accessible through normal odbc.
Bjorn Abelli - 27 Apr 2006 11:27 GMT
"hilz" <now@y.com> wrotw...

>> Now, the tricky part should be how to access that system table from
>> Java...
>>
>> I believe I saw some hack in C++ a couple of years ago that could
>> accomplish this by some low level access to some native API, don't ask me
>> where I saw it...

> I don't believe you need a low level access to some native API to see
> those system tables because if you connect to MS Access using the
> myeclipse db explorer (odbc dns-less connection) you can see the system
> tables there. so i guess it is accessible through normal odbc.

Well, guessing is one thing... ;-)

Why would you guess that db explorer doesn't use lower level API's?

After all, they ship in different packages depending on operating systems,
which should mean that they have some JNI going on in there...

Have you tried to access the system tables in an Access database with jdbc
through just select statements in a default setup? That simply won't work,
as it will complain about unsufficient privilegies.

But I won't say that there couldn't be other ways to override the security
issues.

// Bjorn A
Jochen Riekhof - 27 Apr 2006 16:25 GMT
> Have you tried to access the system tables in an Access database with jdbc
> through just select statements in a default setup? That simply won't work,
> as it will complain about unsufficient privilegies.
>
> But I won't say that there couldn't be other ways to override the security
> issues.

First, Thank you for all the input!
Yep, insufficient privilegies is exactly what I experience even with ADO
queries. I will invesitagtte on getting the provileges for MSysObjects
as this seems to be the most feasible way to me.

Ciao

...Jochen
webmaster.hxtt@gmail.com - 26 Apr 2006 17:13 GMT
If you have only a few QuerySQL, the quicker wayis to copy all sql
manually in MS Access.
If you need a program solution, you can use HXTT
Access(http://www.hxtt.com/access.html), a commerical JDBCdriver for MS
Access.

ResultSet rs=dbmd.getTables("adb",null ,null, new String[]{"VIEW"});
while(rs.next()){
    String viewName=rs.get("table_name");
    String sql=rs.get("remarks");
    //...
}


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.