Problem in Inserting string in mysql databse
Hi all,
I am trying to insert string in mysql using java query.As I have taken field varchar,that should be in single quotes,whereas string is having double quotes...so as I am trying to insert data that gives null value all the time.
I did like:
String name=jTextFieldname.getText();
String sql="insert into record_master values (name,orderno,email,dob,address,mobile)";Any pointers are appreciable.
Regards,
Palak
Oh I got the sollution...Tat was something like:
String sql = "INSERT INTO record_master (name, orderno,email,dob,address,mobile,imeino) " +
"VALUES('" + name + "', '" + orderno + "','" + email + "','" + dob +"','" + address +"','" + mobile + "','" + imei + "')";
Regards,
Palak
Similar Messages
-
Problem in inserting data into MySQL table
Hi All,
I have a table with just two fields FIRSTNAME and SECONDNAME in MySQL. I am accepting the First Name and Second Name in two text fields and then trying to insert them into the MySQL table. I have set the concurrency of the rowset to CONCUR_UPDATABLE and am using the code clip for Database row insert with the appropriate changes. When I run the application it doesnt give me any errors but the data is also not inserted in the table. Can someone pls help me out.
Loneliness wins the race :-)This is my problem when inserting single row. What does it means ?
MusicInsert: com.mysql.jdbc.NotUpdatable: Result Set not updatable.This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, the query must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details -
Problem with retriving string from mysql DB
hi,
i am storing kannada (india) string into mysql database, that column is
utf8_general_ci . when saw in db it showing ??????.
while retriving it also printing ?????.
what do with this problme, please help to solve this problem..
thanks
dayahi,
i am storing kannada (india) string into mysql
database, that column is
utf8_general_ci . when saw in db it showing ??????.
while retriving it also printing ?????.
what do with this problme, please help to solve this
problem..
thanks
daya
hi,
i am storing kannada (india) string into mysql
database, that column is
utf8_general_ci . when saw in db it showing ??????.
while retriving it also printing ?????.
what do with this problme, please help to solve this
problem..
thanks
dayayou should store the text (kannada-writing) not within a normal CHAR or VARCHAR field in the MySQL-Database. instead store it in a BLOB-field and then retrieve the String by String out=new String (rs.getBytes()); (the BLOB field is used like a Stream so make the appropriate preparations and it should work!
if not you can alter the above new String to new String(rs.getBytes(),"string-format"); where string-format is the iso-name for your language for instance for western europe "ISO-8859-1" -
Problem with inserting data into mySQL database with jsp
I have a jsp page that collects infromation about a users vehicle and puts the data into a mySQL database. Iv'e been messing around with it for ages & i can't seem to get it to work even though i cannot see anything wrong with the code, which can be seen below.
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="Connections/connection.jsp" %>
<%
// *** Restrict Access To Page: Grant or deny access to this page
String MM_authorizedUsers="";
String MM_authFailedURL="login_form.jsp";
boolean MM_grantAccess=false;
if (session.getValue("MM_Username") != null && !session.getValue("MM_Username").equals("")) {
if (true || (session.getValue("MM_UserAuthorization")=="") ||
(MM_authorizedUsers.indexOf((String)session.getValue("MM_UserAuthorization")) >=0)) {
MM_grantAccess = true;
if (!MM_grantAccess) {
String MM_qsChar = "?";
if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&";
String MM_referrer = request.getRequestURI();
if (request.getQueryString() != null) MM_referrer = MM_referrer + "?" + request.getQueryString();
MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + java.net.URLEncoder.encode(MM_referrer);
response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
return;
String vehicle_details__registration = null;
if(request.getParameter("txt_registration") != null){ vehicle_details__registration = (String)request.getParameter("txt_registration");}
String vehicle_details__make = null;
if(request.getParameter("txt_make") != null){ vehicle_details__make = (String)request.getParameter("txt_make");}
String vehicle_details__model = null;
if(request.getParameter("txt_model") != null){ vehicle_details__model = (String)request.getParameter("txt_model");}
String vehicle_details__colour = null;
if(request.getParameter("txt_colour") != null){ vehicle_details__colour = (String)request.getParameter("txt_colour");}
String vehicle_details__tax_class = null;
if(request.getParameter("select_tax_class") != null){ vehicle_details__tax_class = (String)request.getParameter("select_tax_class");}
String vehicle_details__chasis_num = null;
if(request.getParameter("chasis_num") != null){ vehicle_details__chasis_num = (String)request.getParameter("chasis_num");}
String vehicle_details__status = null;
if(request.getParameter("radio_status") != null){ vehicle_details__status = (String)request.getParameter("radio_status");}
String owner_details__MMColParam = "1";
if (session.getValue("MM_Username") !=null) {owner_details__MMColParam = (String)session.getValue("MM_Username");}
Driver Drivervehicle_details = (Driver)Class.forName(MM_connection_DRIVER).newInstance();
Connection Connvehicle_details = DriverManager.getConnection(MM_connection_STRING,MM_connection_USERNAME,MM_connection_PASSWORD);
PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
vehicle_details.executeUpdate();
%>
<form name="add_vehicle_form" id="add_vehicle_form">
<p>Registration mark:
<input name="txt_registration" type="text" id="txt_registration">
</p>
<p>Make:
<input name="txt_make" type="text" id="txt_make">
</p>
<p>Model:
<input name="txt_model" type="text" id="txt_model">
</p>
<p>Colour:
<input name="txt_colour" type="text" id="txt_colour">
</p>
<p>Tax Class:
<select name="select_tax_class" id="select_tax_class">
<option value="AAA">Band AAA (up to 100g/km)</option>
<option value="AA">Band AA (101 - 120g/km)</option>
<option value="A">Band A (121 - 150g/km)</option>
<option value="B">Band B (151 - 165g/km)</option>
<option value="C">Band C (166 - 185g/km)</option>
<option value="D">Band D (Over 185g/km)</option>
</select>
</p>
<p>Chasis Number:
<input name="txt_chassis_num" type="text" id="txt_chassis_num">
</p>
<p>Status: active:
<input name="radio_status" type="radio" value="1" checked>
off-road
<input name="radio_status" type="radio" value="0">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<%
Connvehicle_details.close();
%>This is the error I am getting from the server
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 3 in the jsp file: /add_vehicle_form.jsp
Generated servlet error:
C:\Servers\Tomcat 5.0\work\Catalina\localhost\Assignment\org\apache\jsp\add_005fvehicle_005fform_jsp.java:113: ')' expected
PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Any help would be much appreciated.
Thanksuse this ...
PreparedStatement vehicle_details =
Connvehicle_details.prepareStatement("INSERT INTO
vehicle_man_db.vehicle_details (registartion, make,
model, colour, tax_class, chasis_num) VALUES
vehicle_details .setString(1,String
vehicle_details__registration );
vehicle_details setString(2,String
vehicle_details__make );
vehicle_details .setString(3,String
vehicle_details__model );
vehicle_details .setString(4,vehicle_details__colour
vehicle_details .setString(5,String
vehicle_details__tax_class);
vehicle_details .setString(6,String
vehicle_details__chasis_num );
vehicle_details .executeQuery();Even you need a screwing up... what's the point putting that String inside. That's the bloody error. -
Some problems about insert String into JTextPane
here is the colde:
HTMLEditorKit kit = new HTMLEditorKit();
HTMLDocument doc =(HTMLDocument)kit.createDefaultDocument();
String str="hello world";
SimpleAttributeSet attr =new MutableAttributeSet();
StyleConstants.setFontFamily(attr, "Times New Roman");
StyleConstants.setFontSize(attr, 12);
StyleConstants.setBold(attr, true);
StyleConstants.setBackground(attr, UIManager.getColor("control"));
doc.insertString(1,str,attr);
JTextPanel panel =new JTextPanel();
panel.setEditorKit(kit);
panel.setDocument(doc);
text "hello word" of document can be show correctly,i save it as a .html file then open it a strange problem occured,i can't see the word "hello world" in panel,i can't find the word "hello word" in html source code except some tags of html,who can tell me what's wrong?thanks in advanced!hello user457523
I have found the reason to that error.It's because there's a trigger and ext_src_file_nm is populated by the trigger from another column ext_src_file_loc when inserting and I didn't give any value to ext_src_file_loc so ext_src_file_nm is null.
I have disabled that trigger and now I get new errors.When I traced to a line of Jave code I got missing source file warning,and the source file is also oracle.sql.CharacterSet.java.I can not trace into the source file and then I skipped that code and then I got new errors.I want to know how to trace into the jave code and find what's the matter.
Thank you very much. -
Problem to insert Chinese Characters(GB3212) into MySQL
I met a problem to insert Chinese Characters (GB3212) into MySQL using Entity Bean (or JPA).
For example, when a hardcoded string "{color:#ff0000}电器me元件{color}" is inserted, it is displayed as "{color:#ff0000}??me??{color}" in MySQL.
The NamedQuery is also not working for Chinese Characters.
The setting are as following:
GlassFish JDBC connection pool: useUnicode=true, charecterEncoding=gb2312
NetBeans IDE: source encoding set to GB2312;
MySql table: the column set to CHARACTER SET gb2312;
Any experts, please give advice
Thanks lotI didn't noticed that there is a {color:#ff0000}sun-resources.xml{color} file under {color:#ff0000}<ejb project>/server resources{color}.
This file has a pool configuration. This config just overwite the paremeter i added using Admin Console every time a client is lauched. So there are two option to fix this problem.
1. Insert the follwowing two lines into the {color:#ff0000}sun-resources.xml{color}
<property name="characterEncoding" value="gb2312"/>
<property name="useUnicode" value="true"/>
2. delete the everthing in the {color:#ff0000}sun-resources.xml, using Admin Console {color}config your own pool & DataSource
I tried first option & it works. -
A problem with inserting into DB hebrew strings
Hi,
I am working with a 8.1.7 DB version, and use thin driver.
I have my DB Charest configured to iso 8859P8 (which is visual Hebrew)
I have no problem in making a connection and retrieving strings, using SELECT * FROM ..
and then use the ResultSet.getString(String columnName) method .
I also have no problem in inserting the Hebrew characters , and retrieving them back ( I represent them in a servlet ),
The only problem I do have, is when I try to insert into DB a row in the following manner
INSERT into table_name values( Hebrew_String_value1, Hebrew_String_value2, Hebrew_String_value3, Hebrew_String_value4)
the insertion works fine , but somehow the insertion misplaces the strings order and actually the insertion is in opposite order :
Hebrew_String_value4, Hebrew_String_value3, Hebrew_String_value2, Hebrew_String_value1.
If I use the same insert with English Strings , there is no problem.
does any one have the solution how I insert the strings in the right order ?
one solution I have is to insert only one column and then update the table for each column , but then , instead of one execute() action , I have to make ,
1 execute() + 9 executeUpdate() for a 10 column tableCan you try specify the column order in your INSERT statement, i.e.
INSERT INTO mytable( column1_name,
column2_name,
column3_name,
column4_name )
VALUES( column1_string,
column2_string,
column3_string,
column4_string)My wild guess, though I can't understand why at the moment, is that there may be a problem because Hebrew is read from right to left, that may be causing a problem.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Problem while inserting into a table which has ManyToOne relation
Problem while inserting into a table *(Files)* which has ManyToOne relation with another table *(Folder)* involving a attribute both in primary key as well as in foreign key in JPA 1.0.
Relevent Code
Entities:
public class Files implements Serializable {
@EmbeddedId
protected FilesPK filesPK;
private String filename;
@JoinColumns({
@JoinColumn(name = "folder_id", referencedColumnName = "folder_id"),
@JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)})
@ManyToOne(optional = false)
private Folders folders;
public class FilesPK implements Serializable {
private int fileId;
private int uid;
public class Folders implements Serializable {
@EmbeddedId
protected FoldersPK foldersPK;
private String folderName;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "folders")
private Collection<Files> filesCollection;
@JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)
@ManyToOne(optional = false)
private Users users;
public class FoldersPK implements Serializable {
private int folderId;
private int uid;
public class Users implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer uid;
private String username;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "users")
private Collection<Folders> foldersCollection;
I left out @Basic & @Column annotations for sake of less code.
EJB method
public void insertFile(String fileName, int folderID, int uid){
FilesPK pk = new FilesPK();
pk.setUid(uid);
Files file = new Files();
file.setFilename(fileName);
file.setFilesPK(pk);
FoldersPK folderPk = new FoldersPK(folderID, uid);
// My understanding that it should automatically handle folderId in files table,
// but it is not…
file.setFolders(em.find(Folders.class, folderPk));
em.persist(file);
It is giving error:
Internal Exception: java.sql.SQLException: Field 'folderid' doesn't have a default value_
Error Code: 1364
Call: INSERT INTO files (filename, uid, fileid) VALUES (?, ?, ?)_
_ bind => [hello.txt, 1, 0]_
It is not even considering folderId while inserting into db.
However it works fine when I add folderId variable in Files entity and changed insertFile like this:
public void insertFile(String fileName, int folderID, int uid){
FilesPK pk = new FilesPK();
pk.setUid(uid);
Files file = new Files();
file.setFilename(fileName);
file.setFilesPK(pk);
file.setFolderId(folderId) // added line
FoldersPK folderPk = new FoldersPK(folderID, uid);
file.setFolders(em.find(Folders.class, folderPk));
em.persist(file);
My question is that is this behavior expected or it is a bug.
Is it required to add "column_name" variable separately even when an entity has reference to ManyToOne mapping foreign Entity ?
I used Mysql 5.1 for database, then generate entities using toplink, JPA 1.0, glassfish v2.1.
I've also tested this using eclipselink and got same error.
Please provide some pointers.
ThanksHello,
What version of EclipseLink did you try? This looks like bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=280436 that was fixed in EclipseLink 2.0, so please try a later version.
You can also try working around the problem by making both fields writable through the reference mapping.
Best Regards,
Chris -
Problem in establishing connection with mysql 5.0
Hi,
I am using JCAPS 5.1. I tried to insert data to mysql database table.
But i got following error
java.sql.SQLException: Error in allocating a connection. Cause:
Physical Connection doesn't exist.
My intention is to read file in which data are comma seperated and to
populate those values to a mysql 5.0 database table.
Sample DATA in file [test.txt]
111,gg,23,MFG
112,hh,24,MFG
113,ii,25,RETAIL
114,jj,26,IT
Database table: employee
eno,ename,eage,edept
While creating JDBC OTD there is no problem in establishing connection with database. But after deploying i got above error.
I have used Mysql 5.0 Connector/J JDBC driver. Added JDBC driver jar files to following directories as required.
1) C:\JavaCAPS51\logicalhost\is\lib
2)C:\JavaCAPS51\logicalhost\is\domains\test\lib
Steps i have followed as per JDBC-ODBC -eway user guide doc.
1) Created USerDefined OTD and added necessary fields
2) Created JDBC OTD.
3) Created JAVA collaboration and do business process for inserting
4) Mapped all components by creating in Connectivity MAp
5) created necessary external systems in envrionment explorer.[JDBC External System and File External System]
6)Created Deployment profile
5) Deployed it.
After deploying it gives error as
java.sql.SQLException: Error in allocating a connection. Cause: Physical Connection doesn't exist
Please let me know the solution for problem.
Message was edited by:
VenkateshSampoornamIn the environment definition,
-> External Application JDBC
-> Properties
-> Outbound JDBC Connection
You have the database URL in the "DriverProperties" field
Valid URL would be : jdbc:mysql://localhost:3306/caps
!! The doc says that this field is optional !! Seems to be an error in the doc:
Hope this helps
Seb -
Inserting strings over 2000 in length
Hi,
I'm trying to populate a database table which contains a long and
I've been running into two Oracle errors:
ORA-01462: cannot insert string literals longer than 2000
characters
and
ORA-01489: result of string concatenation is too long
Can someone point me to documentation or a solution of how you
can get a 29k string into the database? I have code regarding how
to use LOBs, but I'm unfamiliar with any stored procedures which
will allow you to append to a long column with new content. I
need to use long for the project I am working on.
Thanks in advance for your help!
Jill
nullHi Ralf,
If you read the documentation on
http://java.sun.com/products/jdbc/index.html you will
find a statement saying that the JdbcOdbcDriver is
only for test and experimental use.Yes, but my and other's experiences with the JDBC-ODBC bridge itself are very well.
Since it is only a bridge over the specific vendor's ODBC driver, you are limited to the capabilities of that.
But the bridge is not to blame for this.
For MS products you may reach efforts by updating to an actual MDAC version.
Nethertheless, with MS ODBC there are some problems.
Search the driver database (a link is on the above web
page) for another (commercial) driver. I recommend the
type 4 driver from i-net.Ok.
Have you tried out that error David reported with the i-net driver?
I use JDBC-ODBC with MS SQLServer 2000, actual MDAC, and I get that error with PreparedStatement.
But it's all ok with a normal statement.
So if you could test them both with the i-net driver, we would see if it's again the MS ODBC driver.
Regards,
Ralf SchumacherI think, I'm not the first you asks this:
you are not the quick one we saw in Suzuka on Sunday, are you? -
Problem on inserting text from file to a clob column
Hi! I'm having problem in inserting text read from a text file to a clob column in my table.
Here's my code
public void addSyllabusOutline(int syllid)
CLOB objclob1 = null;
CLOB objclob2 = null;
String query = "SELECT outline, projoutline FROM Syllabus WHERE syllabusid = '"+ syllid +"' FOR UPDATE";
try
System.out.print("Getting syllabus outline and projoutline clob locator...");
DBConnection dbconnbean = new DBConnection();
dbconnbean.openConnection();
ResultSet rst = dbconnbean.executeQuery(query);
if(rst.next())
objclob1 = (oracle.sql.CLOB)rst.getClob("outline");
objclob2 = (oracle.sql.CLOB)rst.getClob("projoutline");
Writer clobwriter1 = ((oracle.sql.CLOB)objclob1).getCharacterOutputStream();
String filename1 = "c:\\o1u2t3l4i5n6e7.txt";
File outlinefile1 = new File(filename1);
FileReader outlineFileReader1 = new FileReader(outlinefile1);
char[] cbuffer1 = new char[10 * 1024];
int nread1 = 0;
while((nread1 = outlineFileReader1.read(cbuffer1)) != -1)
clobwriter1.write(cbuffer1, 0, nread1);
//clobwriter1.flush();
clobwriter1.close();
Writer clobwriter2 = ((oracle.sql.CLOB)objclob2).getCharacterOutputStream();
String filename2 = "c:\\p1r2o3j4o5u6t7l8i9n0e.txt";
File outlinefile2 = new File(filename2);
FileReader outlineFileReader2 = new FileReader(outlinefile2);
char[] cbuffer2 = new char[10 * 1024];
int nread2 = 0;
while((nread2 = outlineFileReader2.read(cbuffer2)) != -1)
clobwriter2.write(cbuffer2, 0, nread2);
//clobwriter2.flush();
clobwriter2.close();
System.out.println("done");
dbconnbean.closeConnection();
catch(Exception e)
System.out.println("Error: " + e);
My error is java.sql.SQLException fetch out of sequence. I don't have an Idea on what seems to be the problem. Please help.. Thank you very much. ^_^Hi,
Print the whole stack trace. It will tell you the line which causes the error. How you use clob and blob in oracle is also version dependent. Try to google for
oracle "your version" java clob example.
/Kaj -
Convert string to mysql datetime in java
Hi,
Can somebody suggest me how to convert a date string in this format - Mon Aug 10 16:36:00 CDT 2009 to a MySql DateTime in Java?
This date is the result of Apache POI. Below is my code:
if(HSSFDateUtil.isCellDateFormatted(hssfCell)) {
cellData = HSSFDateUtil.getJavaDate(hssfCell.getNumericCellValue()).toString();
break;
I want to insert cellData into MySql DateTime field.
Thanks.First I would use a SimpleDateFormat object to parse that into a java.util.Date object.
Then I would create a java.sql.Timestamp object from that and insert it into a PreparedStatement which updates the appropriate column in your MySQL table. Note that using a PreparedStatement removes all the uncertainty of creating something in a "MySQL" format as it just tells the JDBC driver to deal with those details. -
Error occured when connect to MySql Databse in Dreamweaver
Hello! I met a problem when connect to Mysql Databse in
Dreamweaver
Details:
My Php Environment: Php 5.2.2+ MySql 5.0.4 + IIS 6.0 + DW IDE
+ WinXP SP2,
All necessary sevice started(Actually I have never stopped
any Windows service).
Php installed (IIS + CGI) and tested successfully in DW
MySql Installtion(Typical Install with extensions ) and
configuration are both OK.
Configuration Details:
For configuration type, select Detailed Configuration.
For server type, select Developer Machine
For database usage, select Non-Transactional Database Only.
For the number of concurrent connections, select Decision
Support(DSS)/OLAP.
For networking options, accept the default settings.
For the default character set, accept the default setting.
For the Windows options, select both options – Install
As Windows Service, and Include Bin Directory in Windows Path.
For security options, enter a root password and confirmed.
And then I Created a database "mydb" with 3 tables inside by
"MySql Command Line Client",
...... (Approach Obmit here)
Open "MySql Command Line Client":
Type >mysql Show Database mydb;
Show a list with 3 tables(Created Successfully)
Then In DW,
Open my Php webpage,
Then from Database Panel>MySql Connection,
Connect Name:myconn
Mysql Server:localhost
Username:root (Right)
Password:111111(Right)
Database:mydb
Click "OK", but when DW tried to connect to MySql database,
then DW popuped an alert dialog says "HTTP Error Code 502 Bad
Gateway",
I don't know what this mean and how to solve this problem,
hope any PHP and DW expert can help me, thank you very much.Phoenix Wang wrote:
> Click "OK", but when DW try to connect to MySql
database, then popup an alert
> dialog says "HTTP Error Code 502 Bad Gateway",
> I don't know what this mean and how to solve this
problem, hope any PHP and DW
> expert can help me, thank you very much.
How have you set up the Testing server in your site
definition?
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Hi,
I have a JSP form that takes the date and inserts it into the db. I'm having a problem with what format the date should be in. My insert string looks like
INSERT INTO users (USERNAME, WHO_CREATED, WHEN_CREATED) VALUES ('bob', 'jeff', (Result.getString("sysdate"))
unfortunatly whatever format I put the date in I can't seem to make both JAVA and ORACLE happy.
I'm new at this so I'm hoping that is something simple.
Thanks,
Chris
nullHi Chris,
Are u using Business components for java i.e. entity/view objects? If yes, then the default date format for entity/ view objects is
"yyyy-mm-dd".
Aparna. -
Hi all,
i'm finding problem in retriving string
i'm getting only first line as output
the coding is
import java.io.*;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
class newprg2
public static void main(String args[]) throws IOException
InputStream in = new FileInputStream("e:/rag.txt");
//OutputStream out = newFileOutputStream("e:/rag1.txt");
int c,pos,pos1;
String s=new String();
StringBuffer sb = new StringBuffer();
while((c=in.read())!=-1)
sb.insert(0,(char)c);
sb = sb.reverse();
s = sb.toString();
pos = s.indexOf("verify scan_test",0);
s=s.substring(pos+1);
while(pos>=0)
pos=s.indexOf("_cpdp_=",pos);
pos=s.indexOf("=",pos);
pos1=s.indexOf(';', pos);
s=s.substring(pos+1,pos1);
System.out.println(s);
}here's the input file
verify scan_test {
Abb {* verify:0 Value:0 lifecycle:0 *}
W tset_tp;
S { _cpdp_=YYYY10YYYYYYYYYYYYYYYYYYY;
Abb {* Begin loop test *}
S { _cpdp_=YYYY10YYYYYYYYYYYYYYYYYYY;
S { _cpdp_=YYYY110YY1YYYYYYYYYYYYYYY;
S { _cpdp_=YYYY110YY1YYYYYYYYYYYYYYY;
S { _cpdp_=YYYY111YY1YYYYYYYYYYYYYYY;
}now i'm getting output as
YYYY10YYYYYYYYYYYYYYYYYYY
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at newprg2.main(newprg2.java:42)but i want output as
YYYY10YYYYYYYYYYYYYYYYYYY
YYYY10YYYYYYYYYYYYYYYYYYY
YYYY110YY1YYYYYYYYYYYYYYY
YYYY110YY1YYYYYYYYYYYYYYY
YYYY111YY1YYYYYYYYYYYYYYYManivel wrote:
raghavan,
Alter the code inside the while loop like below, you will get as what you expected.
while (pos >= 0) {
s = s.substring(pos + 1);
pos = s.indexOf("_cpdp_=", pos);
pos = s.indexOf("=", pos);
pos1 = s.indexOf(';', pos);
String ss = s.substring(pos + 1, pos1);
System.out.println(ss);
}-ManiI'm sorry, but, if you are simply going to spew out the answer to someones homework, you could at least explain what was wrong (before the code). They don't care in the least, but having read it, they may retain at least some spark of the meaning that the lesson was intended to teach. Like this it's just cut and paste, and who gives a damn. They learn a lot that way, NOT!
Maybe you are looking for
-
Randomly occurring error while starting MDB transaction
We have been seeing a strange intermittent problem with MDBs in a clustered WLS 9.1 environment. Our cluster consists of two managed servers, each of which runs on a separate Windows machine, and our application is targeted to both. We use container
-
New Computer to add to existing network
Hello all, I had a wireless network at home with 2 pcs. One tower pc (ethernet cable to router) and a laptop. The tower pc has just been replaced and now I want to get it onto the existing network. Do I have to set the whole lot up again? The router
-
5.1 MODEL SB0220, I need help pleas
I cant get the computer to load the drivers I downloaded. It just wont let me choose the folder from the browse menu. Any help or suggestions would be appreciated. ????Thank You for your time.
-
Cluster Health Monitor - Gui does not connect to loggerd on a 11.2.0.2 RAC
Hi, i'm implementing an 4-Node Oracle RAC 11.2.0.2 on Oracle Linux 5.6. In 11.2.0.2 the chm is integrated in the grid-home. The necessary daemons are running properly. If I use oclumon on a node i get the collected data. The manual explains that i ha
-
DataCursor.size throwing an Exception
When I run some code under a junit test I get the following stack trace: LOCAL EXCEPTION STACK: EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException EXCEPTION DESCRIPTION: java.sql.SQLException: Invalid