Performing sql queries in java without using java libraries
i wonder whether its possible to perform sql queries beginning from create table to updating queries without using the java sql library.
has anyone written such code.
You could use JNI to talk to a native driver like the Oracle OCI driver. Doing this is either exiting or asking for trouble depending on your attitude to lots of low level bugs.
Similar Messages
-
How to connect from java without using oracle client installation
hi ,
Please tell me how to connect from java without using oracle client
Thanks & Regarshttp://www.orafaq.com/wiki/JDBC#Thin_driver
-
Get Native Java Window using Java Access Bridge 2.0.1 & Java 1.6 and above
I want to get the native java window (Like Java Monkey Application and Java Ferret Application) using java only, for that I tried different ways/options but unable to get the native java window and perform actions on that.
It would be really great if you could guide me for that. I am still unable to start the Java Access Bridge.
Please let me know the steps to get native java window using Java Access bridge and JDK 1.6.20.
Also Note that, As per your previous suggestion, I tried to search and call initializeAccessBridge() and shutdownAccessBridge(), But unable to succeed it. I did not find such method in Accessbridge.jar.
Please help me out.
Best RegardsYou might want to check out this thread:
Java Access Bridge and JRE 1.6
If you have Java 6, you'll need to manually install Java Access Bridge 2.0.1. The JAB 2.0.2 installer for Java 6 is also available as a beta:
http://jdk6.java.net/6uNea.html -
Deploying no java applications using Java Web Start
Hi,
I am new to java web start. Is it possible to distribute non java applications using java web start. I have an APP which can run on a desktop in standalone mode. The app has jusy HTML and Java script files. Is it possible to package this app and deploying using java web start? I am assuming If it is possible, I can make updates to the packaged app in the web servers and the updates will be downloaded next time the app is used provided configurations are correct?
thxThe app has jusy HTML and Java script files. Is it possible
to package this app and deploying using java web start? Not really. Resources for JWS need to be zipped,
while this HTML/JS app. will (I guess) not work from
inside the depths of a Jar (or Zip) archive.
Note that you can organise for those files to be
downloaded and expanded onto a known place
on the user's disk, by using an 'installer' element,
but..
...I am assuming If it is possible, I can make updates to the
packaged app in the web servers and the updates ..installers are only called once, and do not 'update'. -
I have a small web app that makes needs to make about 12 SQL queries in a JSP and am trying to figure out what is the best way to do this
I had initially coded this using plain JAVA code in the JSP as follows :-
<%
Connection conn = null;
Statement st = null;
ResultSet rs = null;
try {
st = conn.createStatement();
rs = st.executeQuery("select .........");
%>
But then I came across the SQL Tag Library in an article and wonder if this is more efficient code?
If so does anyone have a pointer to a good intro to these tags as they look complicated (I only am doing queries on the SQL database, no inserts or updates)Sometimes you've gotta do what you've gotta do.
My rule is "no scriptlets".
If you MUST access a database from a JSP, the only right way to do it is to use JSTL <sql> tags.
% -
How to run SQL script file on Linux using Java ?
Hi,
I need to execute .sql file using java. I used following approach for this.
private void runScriptEvent(java.awt.event.ActionEvent evt) {
String sqlOutput = "";
String sqlPromptLines="";
String currentFunctionName = "";
if(con!=null){
String userName = jTextField4.getText();
String password = jPasswordField1.getText();
String databaseName = jTextField3.getText();
try {
String script_location = "";
ProcessBuilder processBuilder =null;
Process process = null;
//File file = new File("C:/ScriptFile");
File file = new File("./SQL_Script");
//File file = new File("E:\\install\\SQL_Script");
if(file.exists()){
File [] list_files= file.listFiles(new FileFilter() {
public boolean accept(File f) {
if (f.getName().toLowerCase().endsWith(".sql"))
return true;
return false;
int count = 0;
for (int i = 0; i<list_files.length;i++){
script_location = "@" + list_files.getAbsolutePath();//ORACLE
//currentFunctionName = list_files[i].getName();
StringTokenizer st = new StringTokenizer(list_files[i].getName(), ".");
while(st.hasMoreTokens()) {
currentFunctionName = st.nextToken();
String extention= st.nextToken();
System.out.println("Function Name = "+currentFunctionName + "\t Extention = " + extention);
processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLE
processBuilder.redirectErrorStream(true);
process = processBuilder.start();
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
String currentLine = null;
while ((currentLine = in.readLine()) != null) {
sqlPromptLines = " "+sqlPromptLines + currentLine +"\n";
count ++;
System.out.println(count+" " + currentLine);
if(currentLine.equalsIgnoreCase("Function created.")){
sqlOutput = "\n" sqlOutput currentFunctionName + " " currentLine"\n" ;
break;
}// end while
in.close();
process.destroy();
}//end for
}//end if file exists
} catch (IOException e1) {
jTextArea1.setText(e1.getMessage());
System.out.println("Script Done");
jTextArea1.append(sqlOutput);
}// end id Connection is not null
Above code working appropriate on Windows but not on Linux.
is there any changes needed ?
Regards,
Ajay
Edited by: Ajay Sharma on Nov 21, 2012 6:43 PMHi gimbal2,
about code
jTextArea1.setText(e1.getMessage());I am using this code so that the user will be prompted with a message rather than stack trace.
About the issue I am getting on linux i believe its because of following statement.
processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLERegards,
Ajay
Edited by: Ajay Sharma on Nov 23, 2012 12:05 PM
Edited by: Ajay Sharma on Nov 23, 2012 12:06 PM -
How to make a table in java without using GUI??
how can i make a table in java without usinf GUI, just simple codes??
NAME ID NUMBER ADDRESS STATUSIf you simply want to store them internally, you don't want to use a table.
Make a simple class with properties id, name, number, address, status. Then create a Hashtable that indexes instances of the class by id or some other property. -
How to upload the file without using java components?
Hello,
I need to upload the file using JSP, but I don't want to use java componets(such as
jspsmart).
Who can tell me how to realize it? This issue is very important to me,
thanks all in advance!make you're own servlet using the multipartrequest from o'reilly.
easy and simple, no jspsmart, only 1 jar file and some descent programming.
I use it like that... -
How we close Views without using Java Script
Hi All,
can you please suggest me how i close view with out using java script.
if possible please reply with code.
Thanks
SivaHi Siva,
You can do this either by hiding your window or by closing the window. Following is the sample code to do that
IWDWindowInfo windowInfo = null;
IWDWindow window =null;
windowInfo = (IWDWindowInfo) wdComponentAPI.getComponentInfo).findInWindows("<<WindowName>>");
if(windowInfo!=null)
window = wdComponentAPI.getWindowManager().createWindow(windowInfo,true);
window.hide();
Try with this code, might be useful for your scenario.
Thanks,
Sandeep -
How to write excel file (.xlsx) using file adapter without using java code
Hi All,
In soa suite 11g Is there any ways to write the data to the excel ( xlsx ) file using fileadapter and not using java code..Thanks in AdvanceHi Siva,
I don't think there is any way to write .xls file directly. You'll have to use some Java API (iText etc.) to create an .xls file. However, you can write .csv file that can be easily converted into .xls at the target end. In MS, it opens as Excel file if delimiter is comma *,*.
Regards,
Neeraj Sehgal -
Getting class not found error running java application using OIM libraries
Hi,
I have created a java application in which I access OIM libraries to fetch user list and then assign user roles. As i run the application it generates exception and program crashes. However, I am using the same libraries in OIM adapters and it is working fine. Following is the exception message i am getting.
Caused by: java.lang.NoClassDefFoundError: org/springframework/jndi/JndiTemplate
at oracle.iam.platform.OIMClient.<init>(OIMClient.java:83)
at RoleAssignment.RoleAssignment.getUserAndChangePassword(RoleAssignment.java:143)
at RoleAssignment.RoleAssignment.execute(RoleAssignment.java:81)
at RoleAssignment.RoleAssignment.main(RoleAssignment.java:36)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.springframework.jndi.JndiTemplate
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)Hi,
I resolved the problem by making spring.jar part of my executable jar file. I have added oimclient.jar, spring.jar, wlfullclient.jar, commons-logging.jar, and eclipselink.jar part of my executable jar. Now I am getting the error below. I googled it and it mentioned that i should add path of authwl.conf in my run configuration in eclipse. So i added the following line in " -Djava.security.auth.login.config=/u01/oracle/Middleware/Oracle_IDM1/server/CustomExec/authwl.conf " under the VM Arguments section of run configuration, but it continues to give the same error.
java.lang.SecurityException: Unable to locate a login configuration
at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at javax.security.auth.login.Configuration$3.run(Configuration.java:247)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:242)
at javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.init(LoginContext.java:234)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:403)
at Thor.API.Security.LoginHandler.weblogicLoginHandler.login(weblogicLoginHandler.java:58)
at oracle.iam.platform.OIMClient.login(OIMClient.java:134)
at oracle.iam.platform.OIMClient.login(OIMClient.java:129)
at com.infotech.tra.organization.RoleAssignment.getUserAndChangePassword(RoleAssignment.java:213)
at com.infotech.tra.organization.RoleAssignment.execute(RoleAssignment.java:149)
at com.infotech.tra.organization.RoleAssignment.main(RoleAssignment.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)
Caused by: java.io.IOException: Unable to locate a login configuration
at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:250)
at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:91)
... 24 more -
How Can I execute a java program using java code?
{color:#000000}Hello,
i am in great trouble someone please help me. i want to execute java program through java code i have compiled the java class using Compiler API now i want to execute this Class file through java code please help me, thanks in advance
{color}Thanks Manko.
i think my question was not clear enough.. actually i want to run this class using some java code . like any IDE would do i am making a text editor for java, as my term project i have been able to complie the code usign compiler api and it genertaes the class file but now i want to run this class file "THROUGH JAVA CODE" instead of using Java command. I want to achive it programatically. do you have any idea about it.. thanks in advance -
Invoke exe through java code(using java.lang.Runtime)
Iam trying to invoke an exe from java code.If i give the complete path for that exe it is running fine .But if i set the environment variable and directly execute the exe through command prompt it iss running fine , but it fails to run when i do the same using java code i.e. java.lang.Runtime.exec function
Give "//" for directory seperator.
E.g. r.exec("c://test//test.exe",null);
Why? That doesn't look correct.It is correct. It will work fine. Try it out.But it doesn't add or solve anything. A forward slash
does not need to be escaped.'
It's not even escaping. It's just doubling up. If that works, I'd bet "C://///test///////test.exe" does also. -
How to Secure SQL SERVER 2012 Backup without using TDE or any thirdparty backup solution
Hi Experts
Actually I was using backup set password feature for MS SQL SERVER 2008 but it is dropped in new versions (2012 & 2014). Please suggest some options to making the backups secure without using TDE or any third party tools.Hi khalil_pak,
The WITH PASSWORD feature didn't really encrypt your backup. It just made it difficult for someone to accidentally restore the backup when they were not allowed to. And as other post, the password option is weak and could be broken easily.
The only true way to protect the data is to encrypt the data at the source by encrypting the database with
TDE. Or you can choose to use
cell-level encryption to encrypt sensitive data.
Thanks,
Lydia Zhang
Lydia Zhang
TechNet Community Support -
Cannot Change Java Version Using Java Preferences
When I attempt a change of the current Java version (say, switching from 1.5 to 6) using Java Preferences, the change is reflected in the preferences, but the update does actually occur and java -version continues to report Java 1.5 as the current version.
If I create another account, this work just fine and I can switch versions at will. Anyone have any idea what might be missing from my account?Ok, I figured out what was going on: I had explicitly set my JAVA_HOME in ~/.bash_profile, pointing to the symlinked path for the current JSE. It turns out there a new CLI tool /usr/libexec/java_home that can be used to assign JAVA_HOME like this:
export JAVAHOME=`/usr/libexec/javahome`
Using this will ensure that JAVA_HOME is set to the correct value when the shell starts up (if you don't have JAVA_HOME set at all, you can switch the JSE versions in the Terminal 'on-the-fly' when changing the Java Preferences setting).
http://lists.apple.com/archives/java-dev/2009/Jun/msg00139.html
Message was edited by: stonehippo
Maybe you are looking for
-
Show-stopper with project corruption
Sometimes I feel like I'm being punished. Perhaps it's just bad Karma. I don't know. All I did was change the styles used to create new topics (Framemaker Document Settings window > Style Settings tab > Pagination Settings box). Originally, I selecte
-
My Windows 7 Professional desktop system hard disk got corrupted and I took the opportunity to install an SSD for a new system disk and reinstall Windows. The system is up and running on the SSD, with my old system disk now used for storage as it is
-
Strange problem using webutil "WEBUTIL_CLIENTINFO.GET_HOST_NAME"
in a form in with a use (and work fine) some function of webutil (like client_get_file_name etc) i have try to use this function : :B0.HOST_NAME := WEBUTIL_CLIENTINFO.GET_HOST_NAME; where b0.host_name is a char filed of 256. when i try to execute thi
-
Question re: Editing DVDs made from old VCR tapes
We recently had a relative take some old family VCR tapes and install them on DVDs. Now we want to edit the DVDs. What will we need to edit these. When we open the DVDs there are 2 folders labeled audio TS and Video TS.
-
Hi In my process flow, I have a transformation which outputs parameter B_1, which is a BOOLEAN value. I need to create 2 transitions from this transformation based upon whether B_1 is true or false. In the Transition Condition Editor I select 'Comple