| | |
How to execute MS Access Query using JDBC?
![]() |
•
•
•
•
dear all,
I know how to correctly execute SQL statement using con.execute()
•
•
•
•
(where con is type of java.sql.Connection). But how can I execute Microsoft Access Query Object, which require one or more parameters?
Do we need to use PrepareStatement ?
Thanks
Read the JDBC tutorial.
Last edited by masijade; Mar 29th, 2008 at 9:06 pm. Reason: typo
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
I don't know that Access supports Scrollable ResultSets over the bridge, but I'm not sure, and can't really tel you more, because I, myself, don't use Access. I find it to be the worst DB choice available.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
the bridge driver was created before scrollable resultsets were invented...
And of course using CallableStatement to access SQL (rather than call a stored procedure) is idiotic.
Kid, do as you were told and work your way through the JDBC tutorial.
And of course using CallableStatement to access SQL (rather than call a stored procedure) is idiotic.
Kid, do as you were told and work your way through the JDBC tutorial.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
•
•
Join Date: Mar 2008
Posts: 3
Reputation:
Solved Threads: 0
Thanks for all.
My problems (they are really plural) were solved, because I switch to Access from the former MySQL. I need an environment where I can prototype a lot of database design fast,where at the same time, a fully functional code were developed.
At phase where I don't really understand the whole problem, MS Access really help me : I can design the database very fast. Now, when I need to switch to MySQL for example, I just use database converter utility.
Yes, I don't have any problem when using MySQL. Everything works fine. But, when I switch to Access, problems start to occur.
Isn't Acces Query not the same as Stored Procedure as in any RDMS such as MySQL? (as long as I can remember, using VB 6, I get my Access Query listed in Stored Procedure category when I use Data Report).
I will be really helped, if I can call that sets of Access Query. For now, I just make a Singleton that hold all of my Query Statement ( I copy pasted them from MS Access Query View), and call them using simple Statement such as this one :
String[][] data = DB.getInstance().getDataSet(ApplicationLogic.getInstance().getAllCluster());
where in ApplicationLogic.java there exist a static method that return String :
..
public String getAllCluster(){
return "SELECT SkorKlaster.ID, Klaster_1.Kode, Klaster_1.Nama, Klaster_1.Keterangan, Klaster.Nama, SkorKlaster.Skor
FROM PemakaiBerkas INNER JOIN (Klaster INNER JOIN (SkorKlaster INNER JOIN Klaster AS Klaster_1 ON SkorKlaster.Klaster2 = Klaster_1.ID) ON Klaster.ID = SkorKlaster.Klaster1) ON PemakaiBerkas.ID = Klaster.NamaBerkas
WHERE (((Klaster.Nama)='safety') AND ((PemakaiBerkas.NamaBerkas)='Bridge Selection'))";
}
...
Yes, those long SQL where copy pasted from Microsoft Acces. Maybe I can code it in MySQL Query Browser, but, I think that will be imposible as I work on a lot of database application at once.
My problems (they are really plural) were solved, because I switch to Access from the former MySQL. I need an environment where I can prototype a lot of database design fast,where at the same time, a fully functional code were developed.
At phase where I don't really understand the whole problem, MS Access really help me : I can design the database very fast. Now, when I need to switch to MySQL for example, I just use database converter utility.
Yes, I don't have any problem when using MySQL. Everything works fine. But, when I switch to Access, problems start to occur.
Isn't Acces Query not the same as Stored Procedure as in any RDMS such as MySQL? (as long as I can remember, using VB 6, I get my Access Query listed in Stored Procedure category when I use Data Report).
I will be really helped, if I can call that sets of Access Query. For now, I just make a Singleton that hold all of my Query Statement ( I copy pasted them from MS Access Query View), and call them using simple Statement such as this one :
String[][] data = DB.getInstance().getDataSet(ApplicationLogic.getInstance().getAllCluster());
where in ApplicationLogic.java there exist a static method that return String :
..
public String getAllCluster(){
return "SELECT SkorKlaster.ID, Klaster_1.Kode, Klaster_1.Nama, Klaster_1.Keterangan, Klaster.Nama, SkorKlaster.Skor
FROM PemakaiBerkas INNER JOIN (Klaster INNER JOIN (SkorKlaster INNER JOIN Klaster AS Klaster_1 ON SkorKlaster.Klaster2 = Klaster_1.ID) ON Klaster.ID = SkorKlaster.Klaster1) ON PemakaiBerkas.ID = Klaster.NamaBerkas
WHERE (((Klaster.Nama)='safety') AND ((PemakaiBerkas.NamaBerkas)='Bridge Selection'))";
}
...
Yes, those long SQL where copy pasted from Microsoft Acces. Maybe I can code it in MySQL Query Browser, but, I think that will be imposible as I work on a lot of database application at once.
![]() |
Similar Threads
- java database connectivityl (Java)
- Posting News according to today's date (ColdFusion)
- Java JDBC ResultSet (Java)
Other Threads in the Java Forum
- Previous Thread: C++ version to Java
- Next Thread: why info is disappearing in BundledTomcat output window?
| Thread Tools | Search this Thread |
2dgraphics 3d @param affinetransform android api applet application arc arguments array arrays automation banking binary bluetooth byte chat chatprogramusingobjects class client code color compare component count database design detection eclipse eclipsedevelopment encryption error fractal game givemetehcodez graphics gridlayout gui guitesting helpwithhomework html ide if_statement image input integer interface j2me java java.xls javadesktopapplications javaprojects jni jpanel julia keytool keyword linux list loop macintosh map method methods mobile netbeans newbie object os pong problem producer program programming project projectideas read recursion reference replaysolutions rim scanner server set size sms sort sql string swing terminal threads transforms tree ui unicode validation web windows






