I am getting the user details from database using the following code private Connection conn; public ArrayList getUserInfo() { ArrayList list = new ArrayList(); conn = new DataBaseConnection().getConnection(); ResultSet rs = null; PreparedStatement preparedStatement = null; try { String StrQuery = "select username from usertable"; preparedStatement = conn.preparedStatement(strQuery); rs = preparedStatement.executeQuery(); while(rs.next()) { UseInfoBean userinfobean = new UseInfoBean();//Creating Bean Object userinfobean ... |
Hi, I have the following structure.. import java.sql.SQLData; import java.sql.SQLException; import java.sql.SQLInput; import java.sql.SQLOutput; import java.util.ArrayList; import java.util.List; public class FundVO implements SQLData { private int fundId; private FundGeneralInfoVO generalInfo; private FundApprovalVO approvalInfo; private List relationshipInfo; private List tradingSystemAndCodes; public FundApprovalVO getApprovalInfo() { return approvalInfo; } public void setApprovalInfo(FundApprovalVO approvalInfo) { this.approvalInfo = approvalInfo; } public int getFundId() { return fundId; ... |
Hi: I am migrating application from weblogic 6 to weblogic 9 and the database is 10. There is a database code in the application that calls stored procedure to save some kind of information. The same code works prefectly fine on weblogic 6; however if I run the same code on weblogic 9. It breaks down and I get following exception ... |
oh my god.. I didnt expect to put myself in this situation... 1.) how to make a simple data base using JavaDB 2.) what objects and classes should i use? 3.) how can i connect THAT database into my .jar program 4.) what IDE should i use? NOTE: i dont have any as in ANY IDEA how to make a simple ... |
Why not manage the information using an in-memory cache, which periodically dumps to the database? If you really want all 3 to have simultaneous access, database ACID principles are probably going to cause some users to get stale data exceptions. Alternatively, you could catch stale data exceptions and transparently refresh the user's data. |
If you want to replace one database with another, or replace a strict setup of tables, there are tools for that. But I suspect if you have 4 databases you might need something more fine grain such as "replacing records in table Y after date X", which case I recommend writing your own synchronization tool. By the way, what you're describing ... |
public String getHash(String plainText){ try { // turn password text into byte array. // get an instance of MessageDigest object with an algorithm of your choosing (SHA-1, for example) // create a byte array of raw cipher text by calling digest() method of the MessageDigest on your byte array. // encode raw byte array into a base64 string // store resulting ... |
|
|
|
|
Here i am using my database with in my application /MultiFucntioner/src/main/TelephoneBook.mdb My class is also in this main package Multifunctioner is the application name src is the folder main is the package Telephone.mdb is the database name my database is in a package and in this same package i have my database class too I am using this code to access ... |
A few things: - You can create a connection at the start of your program, and keep using it. - Check if you really need to loop over 1000 records. Can't you query a subset? You seldom need to retrieve 1000 records in a program. - what are you doing inside your "while ( ResultSet.next())" loop? You are running that code ... |
Hi, I have a requirement to make entry to the database for all the custom classes(other than standard ones provided by Java),whenever these are loaded in the application. I can think of the following approach -- have static block in all the user defined classes -- write the required database loading part in the static block. Do you think that there ... |
|
|
Hello, I have a general question about Java applets and databases I have written an applet wich is on a web server and runs in a browser. I would like to read information from a mysql database from the same web server. I can read info from a local mysql database with jdbc connector no problem But to read from a ... |
Most providers give you the info you need to connect to the database from within their network: servername, port and account(s). And you know the name of the database, because you created it with easyPHP. That is the info you need to provide in your JDBC connection. Most providers do not allow that you contact the database outside their network. You ... |
Hello, Right now we're currently planning to upgrade our oracle database from 9i Enterprise to 11g Standard. We were asked to asses if this upgrade would have any impact on our current java applications. Its an upgrade to a higher version of oracle but to a Standard edition. I actually got hold of a table which lists the detailed differences between ... |
Hi all, we have fields containing chinese characters in our database table (Oracle 10G). From the UI, we are sending chinese character to JAVA code and trying to look-up against the table column using JNDI-JDBC connection pooling but are unable to fetch any record. Could anyone help me in this issue? I suspect, encoding might be the culprit. |
Hello, Hope this is the right place for this. I am trying to make a simple application. This application will consist of projects, for which the data entry operator will fill in the values. So, it will be a typical form. the x axis (so to say) of the page will consist of activities (which may also (or may not) have ... |
After having run through Sun's beginning tutorial on JDBC I am playing around with making a small program that retrieves some rows from a local mySQL database. Is it reasonable to create a class whos responsibility is to retrieve rows based on schema-dependent queries ? After this I have been thinking that it seems likely that this class is something I ... |
22. Database coderanch.comWhat kind of "assets" do you plan on managing? How do you plan to use the data? Is this your first attempt at creating an relational database? If so, a tutorial might be best to start with. Any idea of what database you will be using? Finally, Java Ranch is NotACodeMill. We will be glad to help you correct your database ... |
Hello, All, Good Evening . What is the command to create a copy of an existing database in mysql? I need to manipulate my code using duplicate of my database. I tried using mysql dump command to put duplicate copy on my desktop as: Cd /usr/local/mysql/bin ./mysqldump studentdb > ~/Desktop/studentdb.sql But unsuccessful. Help me Professionals. |
|
Hi, I am using mysql 5.1 and 5.0. I would like to calculate Database Disk Usage (Percentage of database disk used) and Database Disk Free Space (Actual free database volume left in MB). I tried following SQL queries: For Database Disk Usage:- SELECT table_schema "Data Base Name", sum( data_length + index_length ) * 100 /sum(data_length + index_length + data_free) "Data Base ... |
I am using the below Java code to set Latin-1 supplement character in the DB (NLS_CHARACTERSET = WE8ISO8859P1) but due to the DB not supporting these characters it is converting it into '?' or inverted '?'. Is there a way to keep the the DB's NLS_CHARACTERSET as WE8ISO8859P1 and still support various languages (Single or Double Byte Unicode characters)? StringBuffer query ... |
Hi to all in the forum! I've been thinking how could i send a sms from my mobile to a database maybe sql server. I did some research and found that maybe using at commands could be an option but still don't know what other options exist. Has someone done something like this? |
HI , I am using IDE netbeans, sql 2008 as data base . Now i tried to create a java application and written the following code : /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package readtextfile; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.InputStreamReader; import java.sql.Connection; import java.sql.DriverManager; import ... |
Hi Everyone, If this is in the wrong place, please forgive me. I am writing a fairly simple program to manage leads for my business. This is not a full blown CRM type of project, nor am I ever intending it to be. It's purpose is simply to keep track of the leads' contact information and keep a history of what ... |
Hello everyone! I am using Apache Derby database with Tomcat and am trying to implement the following ideas: - everyday at 9 pm for e.g. the database must create a new record/row in a table - everyday at 9 pm for e.g. the database must modify an existing record/row's information My web application will be up always once started. Right now ... |
Not sure where to post this... What are your experiences with database design and class design? Do you design the database first and then go on to class design? Or class design first and then the database? Or do you do a interwound incremental process? What would you consider a best approach? |
I dislike MySQL for database purist reasons - I find it difficult to accept a relational database that has a database engine which doesn't honour constraints, and for a long time was not transactional. But that's just my personal prejudice. If you need a free database I believe either are fine these days. |
Hi , I would like to store an object(such as a list) to a database table in a single cell. What I want to do is store the object in a cell , I want to update the state of the object if I want to later on.Is this possible ? Any idea or suggestion will be highly appreciated . Thanks ... |
Hi, I would like to write a database package where the data is stored locally in xml files, and the interface is through an html page. The data is time history measurements of parameters for a number of test conditions. I would like the html interface to allow the user to locate the test point of interest, based on min/max/average values ... |
public class MyGenericServlet extends HttpServlet implements javax.servlet.Servlet { static final long serialVersionUID = 1L; Connection con = null; Statement stmt = null; String jdbcDriver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/craigslistdb"; String userName = "root"; String password = "Password"; ResultSet subCategoryRS = null; List subCategoryList = new ArrayList(); Iterator it = null; public MyGenericServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse ... |
These parameters can be accessed from tables in the database. For examplpe, in Oracle, they will be available in V$SESSION etc. tables. But these tables might vary from DB to DB. I am not so sure about the other databases though. Moreover, you will need dba privileges to access these tables. Building a single application for different DB's may be tough. ... |
The SQL statement in your first attempt was better. Anf the while loop in your new attempt is better. Your new SQL query is invalid. You did not give a table name. (you need to select ). And if you write a where clause in your query (justl like you did in your first example), you only get records where ... |
i would also recommend mysql for a starter, as i found derby impossible to debug, when i had a problem, as the program had the only allowed connection so i couldn't check my results as i stepped through. But once you are past that stage derby (or the other embedded database recommended) for customer installations. |
Hi, I would like to write a stand alone application in Java to organize my tasks and set up reminders via Sms or Email to my mobile. I have followed some trainings in Java but no training explains to me how to build a database to store all my datas (objects) to read them etc .. Maybe it is too complicated ... |
First you need to create the encryption key. The following code assumes that "some_table" exists in "some_db" (neither matters), and that you want to use AES encryption. Class.forName("org.hsqldb.jdbc.JDBCDriver"); Connection con = DriverManager.getConnection("jdbc:hsqldb:file:some_db", "SA", ""); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select CRYPT_KEY('AES', null) from some_table"); rs.next(); String key = rs.getString(1); Store the key in a secure place. Now you can ... |
import java.awt.event.*; import java.awt.*; import java.sql.*; import java.io.*; public class student extends Frame implements WindowListener,ActionListener,ItemListener { private Frame f; private Button ADD, DELETE, UPDATE, CANCEL,bg,start,last,left,right,Edit,report; TextField id,fname,lname,age; private Label l0,l1,l2,l3,l4,l5,l6,l7; TextArea address; Checkbox x,y; static String p,q; public student() { f = new Frame("STUDENT MANAGEMENT SYSTEM"); ADD = new Button("ADD"); ADD.setFont(new Font("Wide Latin", Font.BOLD,12)); DELETE = new Button("DELETE"); DELETE.setFont(new Font("Wide Latin", ... |
First of all, i apologize that i had to post the entire program and that it may cause confusion. Anyway, my problem basically is the database won't take the values i type into the two fields i have here (usernameField and passwordField). Before i had no problems getting it to work but then after i made some modifications i'm now getting ... |
Hi Every one I am just trying to develop a system like an EPOS system which can work in one machines I know some java and I did some small assignments. I would do my GUI using JAVA I know SQL and database and I have decided to use Java DB as an internal Database. probably I will do some SQL ... |
|
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String str1 = jTextField1.getText(); String str2 = jTextField2.getText(); if (evt.getSource() == jButton1) { try { Class.forName("com.mysql.jdbc.Driver"); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/student", "root", "root"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select name,email from stu where email='" + str2 + "'"); while (rs.next()) { String val1 = rs.getString(1); String val2 = rs.getString(2); if ( val1==str1) { System.out.println("login ... |
|
hi all, i have a problem in a project that i am implementing. what i m trying to do is logging into my application via two different users then clicking on a button simultaneously and the result should be that both users see two different outputs from database, two different pages. i am not using Connection pooling, i am using a ... |
i am learning how to use the java derby database as an embedded db in my applications. i know the basics of jdbc programming and have used a little jdbc both in application and web environments but i have some doubts about wheter or not i should fully use jdbc in my application development. i really want to take on the ... |
|
I have been tasked at work with creating a visitor database. I work for the government so it needs to be secure. I don't want to invent the wheel but I am having trouble tracking down one that will fit my needs. It does not need to be complex just a front end that allows for us to insert visitors and ... |
|
|
Good day experts, this code was aimed at performing calculation and inserting the total to database. however, it can only add the first and second amount hence total = amount + rs.getInt(1); for example amount = first or existing amount in the database=300 rs.getInt(1) = second amount to be inputed =200 total =500. Now when I want to input the third ... |
Hi, i am working on a project which provides me with the facility to access the database of any computer irrespective of the O.S and database type. I could execute querys import and export tables of databases of other computers. So i want an idea abt its coding and implementation.I read it on net that it is possible using R.M.I. The ... |
|
It seems to me that much of the work done in terms of storing and manipulating the main two types of spatial data, geometric, and geographic is done by functions and procedures that are part of the database engine. Is this the case? Can user defined functions and procedures be created by a regular user, or must one access the database ... |
Hi Connie, Already replied to your other post, but just in case it helps: * PostGIS builds upon the existing geometric data types in PostgreSQL. * PostGIS also extends the existing indexing mechanisms in PostgreSQL to support indexing of spatial data, which obeys different rules from scalar data. * PostGIS provides a set of additional spatial functions that can be used ... |
Hi, Requirement: To store List> in database. Here String represents the value fetched from excel file and List represents a row containing cells in excel. List> represents all the records from a excel file. There can be lacs of records in the excel data file. Now, the data of this file has to be persisted into database without performance overhead. I ... |
|
Hi, everyone. I have a package that uses three different databases, of which I have to maintain the sql scripts for each upgrade. Does anyone know of some utilities that help with this change management issue. I have looked at LiquidBase already. Hybernate has one built in, but I am far from putting that in. Anyone else? |
I wanted a database which states when an application is started. Which database is good for it? For Example: If I have an address book java application which take in data and store in database. I happen to shut down the system several times in a day. I wanted the DB system should start when a command is given from java ... |
Hello people, I am new to databases. on a question book,i found the belowing question and i were confused.Please somebody help me. Sales Order Processing system has the following entities each stored in a table. Product Product Code Product Name Qty available Price Customer Customer No Customer Name Customer Address Order ... |
Guys, how to make a method for Database Access class for login? Need some help quick.Thanks in advance This is what I got so far public class DatabaseAccess { private Connection connection; public DatabaseAccess() throws ServletException { try { Class.forName("org.postgresql.Driver"); this.connection = DriverManager.getConnection( "jdbc:postgresql:postgres", "postgres", ""); } catch (ClassNotFoundException e) { throw new ServletException("problem loading class", e); } catch (SQLException e) ... |
This could probably go in the patterns forum...or JSP... or... here? Scenario: You want to use a PreparedStatement to issue an INSERT statement somewhere in your application. String command = "INSERT INTO tablename VALUES(?,?,?,?)"; PreparedStatement pstat = connection.prepareStatement(command); pstat.setString(1, Object.getThing1().toString); pstat.setString(2, Object.getThing2().toString); pstat.setString(3, Object.getThing3().toString); pstat.setString(4, Object.getThing4().toString); pstat.executeUpdate(); What if at some point you want to add another field to that tablename ... |
Looks like you are very new to the internet technology, Just think of the simple scenario Bank Applicaiton As per your first quesiton let us put all Bank data in to one table called "Master" the data will be like customerName, Acc, LoanAcc, Saving Acc , CurrentAcc, and then branch, branchManager, headBrach, HeadBankManger, numberOfBranch, numberOfEmployees .... Do you think 1000 column ... |
After creating the scanner console and such, this is my code. I want the user to enter one of two options or it will generate an error message. However, I ALWAYS get the error message, no matter what I enter. System.out.println("Enter the student's status (type either resident or nonresident)"); status = in.next(); System.out.println(status); //simply to check my entry for validity //verifies ... |
Hello everyone, This question is not related to java or jdbc in specific, but i thought there are some great IT professionals in this forum that can help me out. I am currently working on a project for collection of weather data. The problem is with database design. I have a central server where weather data would be coming in from ... |
|
|
Hi Folks, Ive been trying to create a mini crud sample using JSP's ,however Im getting a null pointer exception upon trying to insert into the database . Upon checking I found that the request object does contain the passed data, however the same leads to a NPE when inserting to the DB , ive placed the code below. Any help ... |
"use databaseName" is a SQL command. "set databaseName" is similar but for the first time. I've never seen either used in JDBC before though I suppose you could try passing them via a statement and see what happens. My guess is they won't work because you aren't yet connected to a database and JDBC doesn't have the concept of connecting to ... |
First impressions count as they say. My application - however fool proof I make the install still requires the user to install and configure a database environment. Currently I support mySQL, MS SQL and Oracle. In theory mySQL is the easiest to setup - but the current versions of the SQL Workbench are buggy and problematic. What I would like to ... |
|
Hi Folks, Im trying to fetch data from database and set the value inn my fields which includes a checkbox. Im able to successfully retreive values from the database and also able to populate my text boxes. But cant seem to check a checkbox if its been set . String query= "SELECT OBJECTID,ISACTIVE,CODE,DESCRIPTION,ISEDITABLE,DOMAINTYPE_OID FROM DOMAIN WHERE OBJECTID="+objid ; stmt = con.prepareStatement(query); ... |
Download Click on the file to view full content | ID | Date | Name | Type | Quarter | <% List list = new ArrayList(); try{ Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance(); String host = "jdbc:derby://localhost:1527/Task"; String username = "Task"; String password = "Task"; Connection conn = DriverManager.getConnection(host, username, password); Statement ...i m using eclipse ide can any 1 tell me how to use database in eclipse to develop applications ....i have sql server 5 installed on my machine ...can i use it or oracle has its own server ....if yes then please tell me the ways how to install plugin in eclipse ? | i need to use mysql from ide like eclipse to support my applications database requirements .i have downloaded jconnector from mysql & mysql explorer but didnt know how to use it ? can any one will help me setting this up ..i m a student please help ide forum guyz are useless they didnt revert the mesage soon they take atleast ... | Below is the question i got in exam. 4) What are the space requirements for views? Views require the space used to store a few records in various system tables Views do not store data and therefore use no space Views require as much space as would a table that presented the same data Views require as ... | Hi, I am trying to create a Java based quiz game on Netbeans IDE. What I've been trying to do is to have questions and answers in a database, draw information from there whenever it's required and print the questions/answers in labels in a jFrame. Now, I've tried it with the local MySQL Server and it's working fine. However, to distribute ... | Can somebody help me how to not display a value from dropdown which is populated from database using java. Lets say the value is 'ABC' Here is my code for populating from the database public List findAllTypes(String state, String grp) { state = state.substring(0, 2).toUpperCase(); state = StateConverter.convert(state); String sql = null; sql = "exec sp_all_types ?"; logger.debug("findAllTypes SQL: " + ... | AJAX wouldn't help with that because the client isn't online. I can think of a few approaches: 1) Have a last modified user/time on each row and show the user a list of changes since last login made by the admin. 2) Set up an e-mail notification when the admin changes things. 3) Manually have the admin tell the client when ... | | Here's a tip for all you Java developers working with Oracle or MySQL databases. At least once a week a question pops up here on the JDBC forum, where it is clear that people have no idea how to run their SQL directly on the database, or how to inspect their tables directly, or how to explore stored procedures etc. So ... | Dear Ranchers, I am having a problem inputting values in a database. .xml file ProcessInformation com.example.Web.ProcessInformation ProcessInformation /Processinfo.do 30 index.jsp Index.jsp JSP Page Address Book | Hello. I'm fairly new to the programming and I am still facing difficulties with OOP based concepts. I am trying to build a small standalone swing application with some database functions. I would be thankful for any kind of pointers and I appreciate any discussion on topic. What I have so far: I had in mind that I would create Database ... | | I am working with the Just Java 2 textbook. In chapter 23 it gives directions to download the Mckoi database. I downloaded it and it looks like I only received 1 jar file. The book says there should be 3. It then says to go to c:\mckoil.0.2\demo\simple. The version that I downloaded is mckoiddb_1.2.02. Within demo, there is a folder named ... | | Well, there could be many causes for your very big delays. But first, some things must be clear to rule out obvious reasons. I suppose you don't have many entries, regarding is just an educational project, then, you use an application to consume the database, is it locally, or remote? Which DBMS you use for mantaining it? If you run the ... | | | | I am having trouble with the code... I keep setting the number instead of incrementing it.. I am a beginner and this is confusing to me.. I know what I want it to do.. but it's not doing it. Here is the question: Add a new student to the student table with a student number (stno) one number above the current ... | | Hi, I have never used databases with Java but I have to start now. They are very useful to use with my programs but I have noticed that since using them I haven't got much use for classes yet. A simple example: If I make a program dealing with employees and fill up the database with their entered information, I dont ... | | Hi, Actually i was unable to access the database pool from the jsp code written in eclipse....so when i checked my database pools list in WASCE my database pool was not there.....i created a new database pool....with different name.....and i don't know how but my problem is solved now....my database pool is no longer disappearing on restarting websphere.....I don't know why ... | i am using filemaker developer 5.5 under mac os x as database system and i am trying to access it with the following Java code import java.sql.*; public class ProvaSql { public static void main(String[ ] args) { try { Connection fmpConnection = null; // loading the driver FMPJDBC Class.forName("com.fmi.jdbc.JdbcDriver"); // estabilish connection fmpConnection = DriverManager.getConnection("jdbc:fmpro://localhost/Dipendenti.fp5" ); Statement fmpStatement =fmpConnection.createStatement(); ResultSet ... | Hello, I would like to develop an application that could work with different types of database (Oracle, Informix, db2, Access, MySQL ...). Can anybody confirm me if do understand how JDBC works. Here is what I understand of JDBC : In the Java code of the application, we include SQL Queries that are specific to JAVA (kind of "Java SQL"). Then, ... | |
|